QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#600525#8838. Jesse's JobxydCatGirl#WA 0ms3552kbC++14701b2024-09-29 17:08:122024-09-29 17:08:14

Judging History

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

  • [2024-09-29 17:08:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2024-09-29 17:08:12]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

constexpr int N = 2e5 + 5;

int T, n;
int p[N], q[N];

void solve() {
	std::cin >> n; int ans1 = 0, ans2 = 0, max = 0;
	for (int i = 1; i <= n; i++) std::cin >> p[i], q[p[i]] = i;
	for (int i = 1; i <= n; i++) max = std::max(max, p[i]), ans1 += p[i] == max;
	max = 0;
	for (int i = 1; i <= n; i++) max = std::max(max, q[i]), ans2 += q[i] == max;
	if (ans1 > ans2) for (int i = 1; i <= n; i++) std::cout << i << " \n"[i == n];
	else for (int i = 1; i <= n; i++) std::cout << q[i] << " \n"[i == n];
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	std::cin >> T;
	while (T--) solve();

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3552kb

input:

3
2
2 1
4
2 1 4 3
6
3 5 4 2 6 1

output:

2 1
2 1 4 3
1 2 3 4 5 6

result:

wrong answer Participant didn't find permutation (test case 1)