QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#705742 | #7933. Build Permutation | ohiostatescarlet# | WA | 12ms | 10624kb | Python3 | 328b | 2024-11-03 01:15:40 | 2024-11-03 01:15:40 |
Judging History
answer
n = int(input())
a = list(map(int, input().split()))
b = [[a[i], i] for i in range(n)]
b.sort()
out = [1 for _ in range(n)]
index = n
for x1, x2 in zip(b, b[1:]):
if x1[0] + 1 != x2[0]:
print(-1)
exit()
out[x1[1]] = index
out[x2[1]] = index - 1
index -= 1
print(*out)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 12ms
memory: 10624kb
input:
5 4 2 5 1 3
output:
2 4 1 5 3
result:
wrong answer