mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-01-11 22:31:58 +00:00
B - Vlad and Candies
https://codeforces.com/contest/1660/submission/151521823
This commit is contained in:
parent
d394e4ceb2
commit
e192ddb501
30
CodeForces/1660/B/B.cpp
Normal file
30
CodeForces/1660/B/B.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 2e5 + 5;
|
||||
|
||||
int t, n, a[N];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
|
||||
cin >> t;
|
||||
while (t--) {
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
std::sort(a + 1, a + n + 1);
|
||||
if (n == 1) {
|
||||
cout << (a[1] == 1 ? "YES" : "NO") << endl;
|
||||
} else {
|
||||
cout << (a[n] - a[n - 1] > 1 ? "NO" : "YES") << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user