QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#876724#7933. Build Permutationtassei903#WA 11ms8832kbPython3717b2025-01-31 11:51:272025-01-31 11:51:29

Judging History

This is the latest submission verdict.

  • [2025-01-31 11:51:29]
  • Judged
  • Verdict: WA
  • Time: 11ms
  • Memory: 8832kb
  • [2025-01-31 11:51:27]
  • Submitted

answer

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################


# 1 2 3 4 5
# a(i) - a(j) = - (a(p(i)) - a(p(j)))
# a(i) + a(p(i)) が定数

n = ni()
a = na()
idx = sorted(range(n), key=lambda x: a[x])

T = a[idx[0]] + a[idx[-1]]
if not all(a[idx[i]] + a[idx[-1-i]] for i in range(n)):
    print(-1)
    exit()
ans = [-1] * n
for i in range(n):
    ans[idx[i]] = idx[-1-i]

print(*[i+1 for i in ans])

詳細信息

Test #1:

score: 100
Accepted
time: 11ms
memory: 8832kb

input:

5
4 2 5 1 3

output:

2 1 4 3 5

result:

ok 

Test #2:

score: -100
Wrong Answer
time: 10ms
memory: 8832kb

input:

3
2 2 3

output:

3 2 1

result:

wrong answer Integer 3 violates the range [-1, -1]