QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#715637#6965. Equalize the Arrayhejinming983282#AC ✓112ms9580kbC++231.0kb2024-11-06 12:49:542024-11-06 12:49:54

Judging History

你现在查看的是最新测评结果

  • [2024-11-06 12:49:54]
  • 评测
  • 测评结果:AC
  • 用时:112ms
  • 内存:9580kb
  • [2024-11-06 12:49:54]
  • 提交

answer

// Author : hejinming2012
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define dbg(x) cout << #x " = " << (x) << endl
#define quickio ios::sync_with_stdio(false);
#define quickin cin.tie(0);
#define quickout cout.tie(0);

using namespace std;
inline int read() {
    int now = 0, nev = 1; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') nev = -1; c = getchar(); }
    while(c >= '0' && c <= '9') { now = (now << 1) + (now << 3) + (c & 15); c = getchar(); }
    return now * nev;
}
void write(int x) {
    if(x < 0) putchar('-'), x = -x;
    if(x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

signed main() {
    quickio
    quickin
    quickout
    int T = read();
    while(T--) {
        int n = read(), mx = 0;
        vector <int> a(n);
        map <int, int> mp;
        for(int i = 0; i < n; i++) {
            a[i] = read(), mp[a[i]]++;
            mx = max(mx, mp[a[i]]);
        }
        if(mp.begin() -> second != mx) puts("NO");
        else puts("YES");
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 112ms
memory: 9580kb

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