QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#345244#7933. Build PermutationybyRE 0ms0kbPython3662b2024-03-06 17:27:532024-03-06 17:27:54

Judging History

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

  • [2024-03-06 17:27:54]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-03-06 17:27:53]
  • 提交

answer

N = 200007

n = int(input())
a = [0] * (N + 1)
b = [0] * (N + 1)
p = [0] * (N + 1)
s = [0] * (N + 1)

for i in range(1, n + 1):
    a[i] = int(input())

for i in range(1, n + 1):
    b[i] = i

for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        if a[b[i]] > a[b[j]]:
            b[i], b[j] = b[j], b[i]

for i in range(1, n + 1):
    p[b[i]] = b[n - i + 1]

for i in range(1, n + 1):
    s[i] = a[i] + a[p[i]]

flag = 1
for i in range(2, n + 1):
    if s[i] != s[i - 1]:
        flag = 0
        break

if not flag:
    print("-1")
else:
    for i in range(1, n + 1):
        print(p[i], end=" ")
    print()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

5
4 2 5 1 3

output:


result: