QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#388309#8549. The Gameucup-team3396#WA 9ms52504kbC++141.2kb2024-04-13 14:38:182024-04-13 14:38:18

Judging History

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

  • [2024-04-13 14:38:18]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:52504kb
  • [2024-04-13 14:38:18]
  • 提交

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'