QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#600527 | #8837. Increasing Income | xydCatGirl# | WA | 0ms | 3692kb | C++14 | 701b | 2024-09-29 17:09:07 | 2024-09-29 17:09:08 |
Judging History
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: 100
Accepted
time: 0ms
memory: 3612kb
input:
3 3 1 2 3 4 2 4 3 1 5 1 5 2 4 3
output:
1 2 3 1 2 3 4 1 3 5 4 2
result:
ok Correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3692kb
input:
153 4 2 4 3 1 4 1 4 2 3 5 2 1 4 5 3 5 1 4 5 3 2 4 1 3 2 4 5 1 5 2 4 3 5 5 3 1 2 4 5 4 1 2 5 3 5 1 2 5 3 4 5 3 1 4 2 5 5 5 4 2 3 1 5 2 1 5 4 3 5 3 4 1 5 2 5 1 4 3 5 2 5 5 1 3 4 2 5 5 3 2 4 1 5 1 5 3 2 4 5 2 4 3 1 5 5 1 5 4 3 2 5 1 2 4 5 3 5 4 2 5 3 1 5 1 3 5 2 4 5 3 1 4 5 2 3 2 1 3 5 1 2 4 3 5 5 5 1 ...
output:
1 2 3 4 1 3 4 2 1 2 3 4 5 1 2 3 4 5 1 3 2 4 1 3 5 4 2 3 4 2 5 1 2 3 5 1 4 1 2 4 5 3 2 4 1 3 5 5 3 4 2 1 2 1 5 4 3 1 2 3 4 5 1 2 3 4 5 2 5 3 4 1 5 3 2 4 1 1 4 3 5 2 1 2 3 4 5 1 5 4 3 2 1 2 3 4 5 1 2 3 4 5 1 4 2 5 3 1 2 3 4 5 2 1 3 1 2 4 3 5 2 3 5 4 1 3 4 1 5 2 3 5 4 2 1 3 2 1 2 1 4 3 1 2 3 4 3 4 1 2 ...
result:
wrong answer Jury found better answer than participant (test case 11)