QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#644881 | #8549. The Game | Orthos | WA | 4ms | 7780kb | C++17 | 1.1kb | 2024-10-16 15:47:13 | 2024-10-16 15:47:14 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int t,n,m;
int a[2000006];
int num[2000005];
int mp[2000005];
bool solve(){
cin>>n;
for(int i=1;i<=2*n;i++){
cin>>a[i];
//a[i]=i%n;
mp[a[i]]++;
}
int cnt=0;
for(int i=1;i<=2*n;i++){
num[++cnt]=mp[a[i]];
mp[a[i]]=0;
}
sort(num+1,num+1+cnt);
int l=1,r=cnt;
while(l<=r){
if(num[l]!=1){
return 0;
}
if(num[r]==2){
r--;
}
else if(num[r]>2){
int p=num[r]-2;
num[r]=2;
l+=p;
if(l>=r){
return 0;
}
}
else{
return 1;
}
}
if(num[l]==1){
return 1;
}
else{
return 0;
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>t;
while(t--){
if(solve()){
cout<<"Kevin\n";
}
else{
cout<<"Qingyu\n";
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 7780kb
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: 4ms
memory: 7780kb
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 Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu...
result:
wrong answer 3rd words differ - expected: 'Kevin', found: 'Qingyu'