QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#418863 | #8549. The Game | emsger | WA | 11ms | 3508kb | C++20 | 1.2kb | 2024-05-23 16:12:14 | 2024-05-23 16:12:14 |
Judging History
answer
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using i64 = long long;
using i128 = __int128_t;
using u32 = unsigned int;
using u64 = unsigned long long;
using u128 = __uint128_t;
void set_io(std::string name)
{
#ifndef NO_FREOPEN
freopen((name + ".in").c_str(), "r", stdin);
freopen((name + ".out").c_str(), "w", stdout);
#endif
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
}
void solve()
{
int N;
std::cin >> N;
int n = N * 2;
std::vector<int> cnt(n);
for (int i = 0; i < n; i++) {
int a;
std::cin >> a;
a--;
cnt[a]++;
}
std::vector<int> ccnt(n + 1);
for (int i = 0; i < n; i++) ccnt[cnt[i]]++;
int p = n;
while (!ccnt[p]) p--;
int q = 1;
while (!ccnt[q]) q++;
for (int i = 0; i < n - 2; i++) {
if (i % 2 == 0) {
ccnt[p]--;
ccnt[p - 1]++;
q = std::min(q, p - 1);
while (!ccnt[p]) p--;
} else {
ccnt[q]--;
ccnt[q - 1]++;
q--;
}
if (q == 0) {
q = 1;
while (!ccnt[q]) q++;
}
}
if (ccnt[2]) std::cout << "Qingyu" << std::endl;
else std::cout << "Kevin" << std::endl;
}
int main()
{
int t;
std::cin >> t;
while (t--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3460kb
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: 11ms
memory: 3508kb
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:
wrong answer 1822nd words differ - expected: 'Qingyu', found: 'Kevin'