2023 rcpc

This commit is contained in:
2024-04-22 16:45:09 +03:00
parent a0ddb657b7
commit 156202ada0
61 changed files with 4462 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#warning That's the baby, that's not my baby
typedef long long ll;
void solve() {
int n;
std::cin >> n;
int f[n] = {};
for (int i = 0; i < n; i++) {
int x;
std::cin >> x;
--x;
f[x]++;
}
int gr4 = 0, gr2 = 0;
for (int i = 0; i < n; i++) {
if (f[i] >= 4) {
gr4++;
} else if (f[i] >= 2) {
gr2++;
}
}
if (gr4 > 0 || gr2 >= 2) {
std::cout << "YES\n";
} else {
std::cout << "NO\n";
}
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
int t;
std::cin >> t;
while (t--) {
solve();
}
return 0;
}