QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#392001#8549. The GameGiga_Cronos#WA 2ms3780kbC++201.6kb2024-04-17 01:17:442024-04-17 01:17:44

Judging History

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

  • [2024-04-17 01:17:44]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3780kb
  • [2024-04-17 01:17:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define all(x) (x).begin(), (x).end()
#define pb push_back

typedef long long ll;
typedef vector<int> vi;

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<int> f(2 * n + 1);
        for (int i = 0; i < 2 * n; i++)
        {
            int x;
            cin >> x;
            f[x]++;
        }
        set<int> avs;
        vector<int> f2(2 * n + 1);
        for (int i = 1; i <= 2 * n; i++)
        {
            f2[f[i]]++;
            avs.insert(f[i]);
        }

        bool ok = 1;
        while (1)
        {
            if (avs.size() == 1)
            {
                if (*avs.begin() == 1)
                {
                    ok = 1;
                }
                else
                    ok = 0;
                break;
            }
            auto it = avs.begin();
            it++;
            int v = *it;
            f2[v]--;
            f2[v - 1]++;
            if (!f2[v])
                avs.erase(v);
            avs.insert(v - 1);
            if (avs.count(1))
            {
                f2[1]--;
                if (!f2[1])
                    avs.erase(1);
            }
            else
            {
                ok = 0;
                break;
            }
        }

        ok = !ok;
        if (ok)
            cout << "Qingyu\n";
        else
            cout << "Kevin\n";
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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'