QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#388309 | #8549. The Game | ucup-team3396# | WA | 9ms | 52504kb | C++14 | 1.2kb | 2024-04-13 14:38:18 | 2024-04-13 14:38:18 |
Judging History
answer
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll,ll>
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define per(i,a,b) for(ll i=(a);i>=(b);--i)
using namespace std;
bool Mbe;
ll read(){
ll x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
void write(ll x){
if(x<0)putchar('-'),x=-x;
if(x>9)write(x/10);
putchar(x%10+'0');
}
const ll N=2e6+9;
ll T,n,a[N];
vector<ll>v[N];
void solve(){
n=read();
rep(i,0,n*2+1)v[i].clear();
rep(i,1,n*2)a[i]=read(),v[a[i]].push_back(i);
ll ans=2e9,cnt=0;
rep(i,1,n*2){
rep(j,1,(ll)v[i].size()-1)ans=min(ans,v[i][j]-v[i][j-1]);
}
rep(i,1,n*2){
rep(j,1,(ll)v[i].size()-1){
if(v[i][j]-v[i][j-1]==ans)cnt++;
}
}
if(ans>3)puts("Kevin");
else {
if(ans==3&&cnt<2)puts("Kevin");
else puts("Qingyu");
}
}
bool Med;
int main(){
cerr<<fabs(&Med-&Mbe)/1048576.0<<"MB\n";
T=read();
while(T--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 52504kb
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: 9ms
memory: 50816kb
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 Kevin Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Kevin Qingyu Qingyu Qingyu Kevin Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Kevin Kevin Qingyu Qing...
result:
wrong answer 3rd words differ - expected: 'Kevin', found: 'Qingyu'