QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#609315 | #8549. The Game | ucup-team3651 | WA | 2ms | 7872kb | C++20 | 1.6kb | 2024-10-04 12:01:32 | 2024-10-04 12:01:33 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define pi pair<int,int>
#define vi vector<int>
#define cpy(x,y,s) memcpy(x,y,sizeof(x[0])*(s))
#define mset(x,v,s) memset(x,v,sizeof(x[0])*(s))
#define all(x) begin(x),end(x)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ary array
#define IL inline
#define mod 998244353
#define N 2000005
using namespace std;
int read(){
int x=0,f=1;char ch=getchar();
while(ch<'0' || ch>'9')f=(ch=='-'?-1:f),ch=getchar();
while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
return x*f;
}
void write(int x){
if(x<0)x=-x,putchar('-');
if(x/10)write(x/10);
putchar(x%10+'0');
}
int c[N],buc[N],a[N];
void solve(){
int n=read();
for(int i=1;i<=2*n;i++)buc[i]=0;
for(int i=1;i<=2*n;i++)a[i]=read(),buc[a[i]]++;
int cnt=0,tot=0;
for(int i=1;i<=2*n;i++){
if(buc[i]){
if(buc[i]==1)cnt++;
else c[++tot]=buc[i];
}
}
sort(c+1,c+tot+1);
int flag=0;
for(int i=1;i<=tot;i++){
if(c[i]<cnt)cnt-=(c[i-1]),cnt++;
else if(c[i]==cnt){
if(i!=tot){flag=1;break;}
else break;
}
else{
if(c[i]==cnt+1)cnt=1;
else {flag=1;break;}
}
}
if(flag)printf("Qingyu\n");
else printf("Kevin\n");
}
int main(){
#ifdef EAST_CLOUD
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
#endif
int T=read();while(T--)solve();
}
//cerr<<fabs(&Med-&Mbe)/1048576.0<<"MB\n";
//cerr<<"\n"<<clock()*1.0/CLOCKS_PER_SEC*1000<<"ms\n";
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 7812kb
input:
3 3 1 1 4 5 1 4 2 1 2 3 4 4 1 2 2 3 2 1 1 4
output:
Qingyu Kevin Qingyu
result:
ok 3 tokens
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 7872kb
input:
10000 3 5 5 3 5 4 5 3 1 4 3 1 1 3 3 1 6 3 3 4 4 3 3 4 1 3 1 1 3 5 6 6 3 1 3 3 4 5 1 5 6 5 3 6 2 4 4 6 1 3 4 6 4 4 2 4 3 6 4 1 6 4 6 3 2 4 6 4 2 3 3 2 4 1 5 5 4 3 1 3 6 5 1 1 3 3 2 1 5 3 1 3 6 6 6 2 2 5 3 1 5 2 5 3 3 3 1 3 3 5 4 5 3 1 3 4 2 4 5 3 3 5 6 2 2 2 3 4 3 3 1 2 6 3 3 3 3 3 6 3 3 4 1 3 6 6 4 ...
output:
Qingyu Qingyu Qingyu Qingyu Qingyu Kevin Qingyu Qingyu Qingyu Qingyu Qingyu Kevin Qingyu Qingyu Qingyu Qingyu Kevin Kevin Kevin Qingyu Qingyu Qingyu Qingyu Kevin Kevin Kevin Qingyu Kevin Kevin Qingyu Qingyu Qingyu Kevin Qingyu Qingyu Qingyu Qingyu Kevin Kevin Kevin Kevin Kevin Qingyu Kevin Qingyu Ke...
result:
wrong answer 3rd words differ - expected: 'Kevin', found: 'Qingyu'