QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#391552#8549. The GamewanyurukongWA 6ms3632kbC++17904b2024-04-16 17:09:152024-04-16 17:09:16

Judging History

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

  • [2024-04-16 17:09:16]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:3632kb
  • [2024-04-16 17:09:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int a[N];
map<int, int> st;
signed main()
{
    int T, n, x;
    cin >> T;
    while (T--)
    {
        int res = 0, fg = 1, sum = 0, cnt = 0;
        cin >> n;
        for (int i = 1; i <= 2 * n; i++)
        {
            cin >> a[i];
            st[a[i]]++;
        }
        for (int l = 1, r = 2 * n; l < r; l++, r--)
        {
            if (a[l] != a[r])
                fg = 0;
        }
        if (fg)
        {
            puts("Qingyu");
        }
        else
        {
            for (auto p : st)
            {
                if (p.second == 1)
                    res++;
                else
                    sum += p.second, cnt++;
            }
            if (sum - (cnt - 1) * 2 <= res)
                puts("Kevin");
            else
                puts("Qingyu");
            st.clear();
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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 167th words differ - expected: 'Kevin', found: 'Qingyu'