QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#391338#8549. The Gameucup-team1251WA 3ms3844kbC++17731b2024-04-16 15:41:232024-04-16 15:41:24

Judging History

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

  • [2024-04-16 15:41:24]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3844kb
  • [2024-04-16 15:41:23]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
int n, m;

int a[2000100];

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int T;
	cin >> T;
	while (T--)
	{
		int n;
		cin >> n;
		vector<int> mp(n * 2 + 1);
		for (int i = 1; i <= 2 * n; i++)
		{
			cin >> a[i];
			mp[a[i]]++;
		}
		int l = 1, r = 2 * n;
		bool ok = true;
		while (l <= r)
		{
			if (a[l] != a[r])
			{
				ok = false;
				break;
			}
			l++, r--;
		}
		if (ok)
		{
			cout << "Qingyu\n";
			continue;
		}
		int cnt1 = 0, cnt2 = 0;
		for (int i = 1; i <= 2 * n; i++)
		{
			if (mp[i] == 1) cnt1++;
			else if (mp[i] > 1) cnt2 += (mp[i] - 1);
		}
		if (cnt2 < cnt1) cout << "Kevin\n";
		else cout << "Qingyu\n";
	}


	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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

result:

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