2023 rcpc
This commit is contained in:
45
2023/rcpc/d2/editorial/j-parallelogram-38.cpp
Normal file
45
2023/rcpc/d2/editorial/j-parallelogram-38.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user