QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#196182 | #6965. Equalize the Array | yiyiyi# | AC ✓ | 43ms | 14768kb | C++14 | 1.0kb | 2023-10-01 13:50:28 | 2023-10-01 13:50:28 |
Judging History
answer
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<bitset>
#include<set>
#define int long long
#define lowbit(x) x&(-x)
#define mp make_pair
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define forE(i,x) for(int i=head[x];i;i=nxt[i])
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const int maxn=2e6+5;
const int maxm=2e6+5;
const int mod=998244353;
inline int read()
{
int x=0,f=1;char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=x*10+(c-'0');
c=getchar();
}
return x*f;
}
int a[maxn],cnt[maxn];
signed main()
{
int T=read();
while(T--)
{
int n=read();
rep(i,1,n) a[i]=read(),cnt[i]=0;
sort(a+1,a+n+1);
int mx=0;
rep(i,1,n) cnt[a[i]]++,mx=max(mx,cnt[a[i]]);
if(cnt[a[1]]==mx) puts("YES");
else puts("NO");
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 43ms
memory: 14768kb
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