Submission #527086

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

for i in user2:
    lst.append(int(i))
    if int(i) < 0:
        if abs(int(i)) > change:
            low = abs(int(i)) - change
        neg = True    
    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

    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...