CF1438B.Valerii Against Everyone
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You're given an array b of length n. Let's define another array a, also of length n, for which ai=2bi (1≤i≤n).
Valerii says that every two non-intersecting subarrays of a have different sums of elements. You want to determine if he is wrong. More formally, you need to determine if there exist four integers l1,r1,l2,r2 that satisfy the following conditions:
- 1≤l1≤r1<l2≤r2≤n;
- al1+al1+1+…+ar1−1+ar1=al2+al2+1+…+ar2−1+ar2.
If such four integers exist, you will prove Valerii wrong. Do they exist?
An array c is a subarray of an array d if c can be obtained from d by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
给你一个长度为 n 的数组 b。我们定义另一个长度同样为 n 的数组 a,其中 ai=2bi(1≤i≤n)。
Valerii 声称:数组 a 的任意两个互不相交的子数组的元素和均不相等。你想判断他是否说错了。更准确地说,你需要判断是否存在四个整数 l1,r1,l2,r2,满足以下条件:
- 1≤l1≤r1<l2≤r2≤n;
- al1+al1+1+…+ar1−1+ar1=al2+al2+1+…+ar2−1+ar2。
若存在这样的四个整数,则说明 Valerii 的说法是错误的。是否存在这样的四个整数?
数组 c 是数组 d 的子数组,当且仅当 c 可通过从 d 的开头删除若干(可能为零个或全部)元素、并从结尾删除若干(可能为零个或全部)元素而得到。
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t (1≤t≤100). Description of the test cases follows.
The first line of every test case contains a single integer n (2≤n≤1000).
The second line of every test case contains n integers b1,b2,…,bn (0≤bi≤109).
每个测试包含多个测试用例。第一行包含测试用例的数量 t(1≤t≤100)。随后是测试用例的描述。
每个测试用例的第一行包含一个整数 n(2≤n≤1000)。
每个测试用例的第二行包含 n 个整数 b1,b2,…,bn(0≤bi≤109)。
输出格式
For every test case, if there exist two non-intersecting subarrays in a that have the same sum, output YES on a separate line. Otherwise, output NO on a separate line.
Also, note that each letter can be in any case.
对于每个测试用例,如果数组 a 中存在两个不相交的子数组,且它们的和相等,则在单独一行输出 YES;否则,在单独一行输出 NO。
另外,请注意:每个字母可以是任意大小写。
输入输出样例
输入#1
2 6 4 3 0 1 2 0 2 2 5
输出#1
YES NO
说明/提示
In the first case, a=[16,8,1,2,4,1]. Choosing l1=1, r1=1, l2=2 and r2=6 works because 16=(8+1+2+4+1).
In the second case, you can verify that there is no way to select to such subarrays.
在第一种情况下,a=[16,8,1,2,4,1]。选择 l1=1、r1=1、l2=2 和 r2=6 是可行的,因为 16=(8+1+2+4+1)。
在第二种情况下,可以验证不存在满足条件的两个子数组。
输入解题思路,AI测评打分。不知道怎么写?