QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#392001 | #8549. The Game | Giga_Cronos# | WA | 2ms | 3780kb | C++20 | 1.6kb | 2024-04-17 01:17:44 | 2024-04-17 01:17:44 |
Judging History
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'