QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#196182#6965. Equalize the Arrayyiyiyi#AC ✓43ms14768kbC++141.0kb2023-10-01 13:50:282023-10-01 13:50:28

Judging History

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

  • [2023-10-01 13:50:28]
  • 评测
  • 测评结果:AC
  • 用时:43ms
  • 内存:14768kb
  • [2023-10-01 13:50:28]
  • 提交

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");
	}
}

詳細信息

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