#abc238e. E - Range Sums
E - Range Sums
Score : points
问题描述
Takahashi 拥有一个秘密整数序列 。已知该序列的长度为 。
你想要猜出 的具体内容。他承诺会给你以下 条额外信息。
- 第 条信息: 的值。
如果给出这 条承诺的信息,是否可能确定序列 中所有元素之和,即 呢?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi has a secret integer sequence . You know that the length of is .
You want to guess the contents of . He has promised to give you the following additional pieces of information.
- The -th information: the value .
Is it possible to determine the sum of all elements in , , if the pieces of promised information are given?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If it is possible to determine the sum of all elements in , print Yes
; otherwise, print No
.
Sample Input 1
3 3
1 2
2 3
2 2
Sample Output 1
Yes
From the first and second information, we can find the value . By subtracting the value of from it, we can determine the value .
Sample Input 2
4 3
1 3
1 2
2 3
Sample Output 2
No
We can determine the sum of the first elements of , but not the sum of all elements.
Sample Input 3
4 4
1 1
2 2
3 3
1 4
Sample Output 3
Yes
The fourth information directly gives us the sum of all elements.
update @ 2024/3/10 10:17:33