QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#549585#8549. The GamePHarrWA 7ms3660kbC++20871b2024-09-06 17:59:052024-09-06 17:59:05

Judging History

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

  • [2024-09-06 17:59:05]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3660kb
  • [2024-09-06 17:59:05]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;


using i32 = int32_t;
using i64 = long long;


using vi = vector<int>;
using pii = pair<int, int>;

void solve() {
    int n;
    cin >> n;
    int N = n * 2;
    vi cnt(N + 1);
    for (int i = 1, x; i <= N; i++)
        cin >> x, cnt[x]++;
    set<pii> vis;
    for (int i = 1; i <= N; i++)
        vis.emplace(cnt[i], i);
    for (int i = 1; i < n; i++) {
        auto it = *vis.rbegin();
        vis.erase(it);
        if (--it.first > 0) vis.insert(it);
        it = *vis.begin();
        vis.erase(it);
        if (--it.first > 0) vis.insert(it);
    }
    if (vis.size() == 2) cout << "Kevin\n";
    else cout << "Qingyu\n";
    return;
}

i32 main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int T;
    for (cin >> T; T; T--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3552kb

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: 7ms
memory: 3660kb

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

result:

wrong answer 3rd words differ - expected: 'Kevin', found: 'Qingyu'