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(' ')
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
2764 KB |
Output is correct |
2 |
Correct |
13 ms |
2872 KB |
Output is correct |
3 |
Correct |
12 ms |
2880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
2764 KB |
Output is correct |
2 |
Correct |
13 ms |
2872 KB |
Output is correct |
3 |
Correct |
12 ms |
2880 KB |
Output is correct |
4 |
Incorrect |
13 ms |
2788 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
2764 KB |
Output is correct |
2 |
Correct |
13 ms |
2872 KB |
Output is correct |
3 |
Correct |
12 ms |
2880 KB |
Output is correct |
4 |
Incorrect |
13 ms |
2788 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
617 ms |
23332 KB |
Output is correct |
2 |
Correct |
12 ms |
2892 KB |
Output is correct |
3 |
Correct |
821 ms |
42092 KB |
Output is correct |
4 |
Incorrect |
530 ms |
12488 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
2764 KB |
Output is correct |
2 |
Correct |
13 ms |
2872 KB |
Output is correct |
3 |
Correct |
12 ms |
2880 KB |
Output is correct |
4 |
Incorrect |
13 ms |
2788 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |