QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#203153 | #6965. Equalize the Array | Royo# | AC ✓ | 105ms | 7896kb | C++20 | 926b | 2023-10-06 15:50:09 | 2023-10-06 15:50:09 |
Judging History
answer
#include <bits/stdc++.h>
#include <cstdio>
#define int long long
#define PII pair<int, int>
#pragma GCC optimize("Ofast")
#define NO {puts("NO") ; return ;}
#define YES {puts("YES") ; return ;}
#define pb push_back
#define endl "\n"
#define fi first
#define se second
#define IOS std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
using namespace std;
mt19937 rd(time(0));
const int N = 1e5 + 10;
void solve() {
int n; cin >> n;
map<int, int> mp;
for (int i = 1; i <= n; i ++ ) {
int x; cin >> x;
mp[x] ++ ;
}
//bool ok = true;
int cnt = 1;
int mx = 0;
for (auto it : mp)
{
if (cnt == 1)
{
mx = it.se;
cnt++;
continue;
}
if (mx < it.se)
{
NO;
}
}
YES;
}
signed main() {
IOS;
int t; cin >> t;
while (t -- )
solve();
return 0;
}
// 3
// 5
// 1 2 3 4 5
// 5
// 4 4 1 4 4
// 4
// 2 2 2 2
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 105ms
memory: 7896kb
input:
105 500000 33226 432708 432708 432708 280629 33226 370163 182525 33226 33226 432708 432708 33226 33226 432708 432708 33226 33226 432708 33226 124133 432708 432708 33226 432708 33226 432708 33226 33226 33226 432708 432708 33226 432708 173002 432708 33226 33226 432708 33226 33226 33226 432708 432708 7...
output:
NO NO NO NO NO YES NO YES YES NO NO YES NO YES YES NO YES YES NO NO NO YES NO YES YES YES YES NO NO NO NO NO NO YES YES YES NO NO YES NO NO NO NO NO YES YES NO YES NO NO YES YES NO YES NO NO NO NO NO NO YES YES YES NO NO YES NO YES NO NO NO NO YES NO NO NO YES NO NO YES NO NO NO NO NO YES NO YES YES...
result:
ok 105 lines