QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#355647#7933. Build Permutationfarrellbyu#WA 41ms33988kbPython31.1kb2024-03-17 00:58:072024-03-17 00:58:07

Judging History

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

  • [2024-03-17 00:58:07]
  • 评测
  • 测评结果:WA
  • 用时:41ms
  • 内存:33988kb
  • [2024-03-17 00:58:07]
  • 提交

answer

import sys
#sys.setrecursionlimit(20000)
#from collections import deque #Counter
#from itertools import accumulate, product
#from functools import reduce
#from math import gcd #sqrt
#import math


def rall():
    return [x.strip() for x in sys.stdin.readlines()]
def rl():
    return sys.stdin.readline().strip()
def rl_types(types):
    str_list = [x for x in sys.stdin.readline().strip().split()]
    return [types[i](str_list[i]) for i in range(len(str_list))]

def pr( something='' ):
    sys.stdout.write( str(something) + '\n')
def pra( array ):
    sys.stdout.write( ' '.join([str(x) for x in array]) + '\n')



if __name__ == '__main__':

    N = int( rl() )
    array = list(map(int, rl().split()))

    if len(set(array))==N and min(array)==1 and max(array)==N:
        targ = N+1
        new = []
        locs = {a:i+1 for i,a in enumerate(array)}
        #print(locs)
        for i in range(N):
            #print(array[i],targ-array[i],locs[targ-array[i]])
            new.append( locs[targ-array[i]] )
        print(' '.join([str(x) for x in new]))


    else:
        print(-1)


詳細信息

Test #1:

score: 100
Accepted
time: 6ms
memory: 9508kb

input:

5
4 2 5 1 3

output:

2 1 4 3 5

result:

ok 

Test #2:

score: 0
Accepted
time: 9ms
memory: 9508kb

input:

3
2 2 3

output:

-1

result:

ok 

Test #3:

score: 0
Accepted
time: 32ms
memory: 33928kb

input:

199528
581552649 419782901 924554494 589802859 878336763 659984178 419820729 521791999 956262027 523946290 442086405 808419260 875183942 860794919 584899704 494193909 687014591 794119827 641706288 734029639 795387770 803653459 889799156 455122734 655375888 757642629 427654115 987811208 593072829 584...

output:

-1

result:

ok 

Test #4:

score: -100
Wrong Answer
time: 41ms
memory: 33988kb

input:

199680
774760412 315033238 665140012 402128528 221827348 923752357 281703052 551555739 483983889 622621809 949928382 909484599 413397988 424613137 353323926 392255354 551928848 464853065 860603765 618364501 423106762 752293338 551415838 898671881 969815739 150102831 644806419 333507443 379455235 981...

output:

-1

result:

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