QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#705742#7933. Build Permutationohiostatescarlet#WA 12ms10624kbPython3328b2024-11-03 01:15:402024-11-03 01:15:40

Judging History

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

  • [2024-11-03 01:15:40]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:10624kb
  • [2024-11-03 01:15:40]
  • 提交

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