Submission #527090

#TimeUsernameProblemLanguageResultExecution timeMemory
527090HoneybeeLabels (NOI20_labels)Cpython 3
7 / 100
398 ms20652 KiB
N = int(input())
user2 = input().split()
lst = []
low = 0
change = 0
neg = False
valid = False

for i in user2:
    lst.append(int(i))
    if int(i) < 0:
        if abs(int(i)) > change:
            low = abs(int(i)) - change  
    change += int(i)
        

if N == 2:
    if lst[0] == 0:
        print('-1')
    elif lst[0] == 1:
        print('1 2')
    else:
        print('2 1')
else:
    output = [1 + low]
    for i in range(len(lst)):
        output.append(lst[i] + output[i])
        if output[-1] > N:
            valid = False
            break
        if output[-1] == True:
            valid = True

    if valid == False:
        print('-1')
    else:
        for i in output:
            print(i)
            print(' ')
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...