QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#464988 | #8549. The Game | ucup-team191# | WA | 4ms | 5644kb | C++23 | 996b | 2024-07-06 16:40:43 | 2024-07-06 16:40:43 |
Judging History
answer
#include <cstdio>
using namespace std;
const int N = 2e6 + 500;
int n, A[N], cnt[N], cnt2[N];
int solve() {
scanf("%d", &n);
for(int i = 0;i < 2 * n;i++) cnt[i] = 0, cnt2[i] = 0;
for(int i = 0;i < 2 * n;i++) {
scanf("%d", A + i);
cnt[A[i]]++;
}
bool ok = 1;
for(int i = 0;i < n;i++)
if(A[i] != A[2 * n - i - 1]) ok = 0;
if(ok) {
printf("Qingyu\n");
return 0;
}
for(int i = 0;i <= 2 * n;i++) {
if(cnt[i]) cnt2[cnt[i]]++;
}
int L = 0, R = 2 * n;
for(int i = 0;i < n;i++) {
while(!cnt2[L]) L++;
while(!cnt2[R]) R--;
cnt2[R]--;
if(i == n - 1) break;
if(R - 1) cnt2[R - 1]++;
if(L == R && cnt2[L] == 1) {
printf("Qingyu\n");
return 0;
}
while(!cnt2[L]) L++;
while(!cnt2[R]) R--;
cnt2[L]--;
if(L - 1) cnt2[--L]++;
if(L == R && cnt2[L] == 1) {
printf("Qingyu\n");
return 0;
}
}
printf("Kevin\n");
return 0;
}
int main() {
int T; scanf("%d", &T);
for(;T--;) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5644kb
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: 5620kb
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:
Kevin Qingyu Kevin Kevin Kevin Kevin Kevin Kevin Kevin Qingyu Kevin Qingyu Kevin Qingyu Kevin Kevin Kevin Qingyu Qingyu Kevin Qingyu Kevin Kevin Qingyu Qingyu Kevin Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Qingyu Kevin Kevin Qingyu Kevin Kevin Qingyu Qingyu Kevin Qingyu Qingyu Kevin Qingyu Qingyu K...
result:
wrong answer 1st words differ - expected: 'Qingyu', found: 'Kevin'