QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#644784#8549. The GameOrthosTL 820ms17828kbC++171006b2024-10-16 15:28:402024-10-16 15:28:40

Judging History

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

  • [2024-10-16 15:28:40]
  • 评测
  • 测评结果:TL
  • 用时:820ms
  • 内存:17828kb
  • [2024-10-16 15:28:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int t,n,m;
int a[2000006];
int num[2000005];
bool solve(){
    unordered_map<int,int> mp;
    cin>>n;
    set<int> st;
    for(int i=1;i<=2*n;i++){
        cin>>a[i];
        mp[a[i]]++;
        st.insert(a[i]);
    }
    int cnt=0;
    for(auto v:st){
        num[++cnt]=mp[v];
    }
    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){
            num[r]--;
            l++;
        }
        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;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5856kb

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: 0
Accepted
time: 6ms
memory: 5644kb

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
Kevin
Qingyu
Kevin
Kevin
Kevin
Qingyu
Qingyu
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Qingyu
Qingy...

result:

ok 10000 tokens

Test #3:

score: 0
Accepted
time: 8ms
memory: 5864kb

input:

10000
4
5 7 5 4 2 3 8 2
4
5 3 3 7 7 1 2 6
4
7 4 5 1 5 6 6 4
4
8 7 7 8 1 7 2 2
4
6 7 7 1 8 1 1 3
4
5 4 1 8 6 1 2 6
4
2 8 3 4 2 4 8 7
4
3 3 1 7 7 7 2 3
4
4 7 2 1 3 7 4 7
4
2 3 8 5 3 8 3 8
4
3 4 3 1 3 1 4 4
4
3 6 5 2 2 6 4 7
4
7 6 6 4 3 3 8 6
4
5 2 1 5 4 7 5 6
4
1 7 3 2 2 5 8 5
4
8 8 3 7 2 3 6 6
4
7 5 ...

output:

Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Qingyu
Kevin
Qingyu
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevi...

result:

ok 10000 tokens

Test #4:

score: 0
Accepted
time: 10ms
memory: 5684kb

input:

10000
5
9 7 9 8 5 2 1 4 4 6
5
9 7 9 9 3 3 9 3 5 8
5
10 8 10 4 5 3 10 1 7 2
5
4 4 3 2 1 5 1 6 9 4
5
7 10 10 9 7 5 9 8 10 1
5
3 9 1 2 4 1 4 2 9 8
5
8 2 3 6 5 5 3 9 4 7
5
7 3 5 7 2 9 1 7 6 6
5
3 2 5 3 10 3 7 7 10 7
5
9 2 3 3 7 9 5 4 6 6
5
8 9 5 1 9 8 6 10 7 10
5
4 7 9 3 5 3 2 4 5 4
5
5 4 2 3 2 1 1 6 2 ...

output:

Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Ke...

result:

ok 10000 tokens

Test #5:

score: 0
Accepted
time: 21ms
memory: 5860kb

input:

10000
10
13 17 8 6 6 4 12 17 10 15 16 6 16 18 8 9 13 6 15 18
10
3 14 10 14 11 5 3 14 11 10 18 2 17 7 3 3 17 6 10 14
10
7 19 2 3 19 20 7 2 19 4 8 5 13 12 17 20 18 5 2 16
10
5 8 2 1 13 4 5 16 14 12 10 10 17 6 10 18 15 10 15 11
10
15 8 18 16 5 14 17 6 3 12 6 5 15 13 3 3 19 13 15 20
10
20 9 7 17 16 13 2...

output:

Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Qingyu
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kev...

result:

ok 10000 tokens

Test #6:

score: 0
Accepted
time: 285ms
memory: 5660kb

input:

10000
100
177 134 53 64 138 66 17 184 182 29 143 189 179 18 182 163 107 24 146 65 194 128 24 164 177 104 142 171 166 82 112 4 122 37 92 6 1 107 72 85 62 194 14 90 100 107 79 104 86 150 21 184 144 68 127 182 155 3 153 121 125 38 9 15 71 139 171 39 37 147 70 69 169 109 53 57 193 43 71 168 133 51 104 7...

output:

Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
...

result:

ok 10000 tokens

Test #7:

score: 0
Accepted
time: 354ms
memory: 5788kb

input:

1000
1000
1664 1262 183 77 952 763 492 1285 1781 273 1173 1289 995 349 1932 1765 519 1621 237 148 1863 1263 1208 554 1645 679 1714 1259 392 1325 884 1953 1146 980 1883 1865 1147 1269 134 214 1748 1402 204 1949 1878 1875 1187 1320 1761 1988 730 1971 1661 1045 496 1298 676 545 1466 1849 1509 1655 1569...

output:

Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
...

result:

ok 1000 tokens

Test #8:

score: 0
Accepted
time: 446ms
memory: 6852kb

input:

100
10000
18109 10379 4922 10249 14298 6729 11419 15620 8466 7000 17204 9992 17944 12008 6330 11510 9537 14027 17699 18739 19752 2937 4461 2600 4747 5710 8888 6562 1004 13927 15174 2578 4337 18313 706 1389 5700 8858 8022 7981 3155 1222 10291 3150 8817 13755 19373 13010 9491 7661 16733 4254 7317 1043...

output:

Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
...

result:

ok 100 tokens

Test #9:

score: 0
Accepted
time: 820ms
memory: 17828kb

input:

10
100000
86829 106117 108534 172063 102996 78412 162911 75419 172718 148734 135592 46009 106075 28053 182924 95323 110734 198718 83479 191704 198287 47321 86251 102075 137722 189882 31679 17987 173247 13099 34523 3810 77984 154600 43165 56831 22069 154017 54455 56564 172459 6011 112558 66128 5889 6...

output:

Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin
Kevin

result:

ok 10 tokens

Test #10:

score: -100
Time Limit Exceeded

input:

1
1000000
1327947 342344 921602 1100113 423665 1645931 909055 100809 147445 1080765 1420296 1348957 762517 1508451 1066670 592341 1901140 5477 1135366 22297 27258 1709870 1424297 1909178 660753 455056 1125686 387303 927849 1122877 1402444 1675000 1062804 418127 124688 58087 1575147 1292608 1490221 1...

output:


result: