307936: CF1438B. Valerii Against Everyone
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Valerii Against Everyone
题意翻译
给定 $t$ 组询问,每组询问给定一个数组 $b$,然后构造出一个数组 $a$,其中 $\forall i\in[1,n],a_i=2^{b_i}$,试求出能否找出四个数 $l_1,r_1,l_2,r_2$,满足: - $1\leqslant l_1\leqslant r_1 <l_2\leqslant r_2\leqslant n$。 - $\sum\limits_{i=l_1}^{r_1}a_i=\sum\limits_{i=l_2}^{r_2}a_i$。 Translated by Eason_AC 2020.11.14题目描述
You're given an array $ b $ of length $ n $ . Let's define another array $ a $ , also of length $ n $ , for which $ a_i = 2^{b_i} $ ( $ 1 \leq i \leq 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 $ l_1,r_1,l_2,r_2 $ that satisfy the following conditions: 1. $ 1 \leq l_1 \leq r_1 \lt l_2 \leq r_2 \leq n $ ; 2. $ a_{l_1}+a_{l_1+1}+\ldots+a_{r_1-1}+a_{r_1} = a_{l_2}+a_{l_2+1}+\ldots+a_{r_2-1}+a_{r_2} $ . 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.输入输出格式
输入格式
Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 100 $ ). Description of the test cases follows. The first line of every test case contains a single integer $ n $ ( $ 2 \le n \le 1000 $ ). The second line of every test case contains $ n $ integers $ b_1,b_2,\ldots,b_n $ ( $ 0 \le b_i \le 10^9 $ ).
输出格式
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.
输入输出样例
输入样例 #1
2
6
4 3 0 1 2 0
2
2 5
输出样例 #1
YES
NO