N = int(input())
user2 = input().split()
lst = []
low = 0
change = 0
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]
if output[-1] == N:
valid = True
for i in range(len(lst)):
output.append(lst[i] + output[i])
if output[-1] == N:
valid = True
if output[-1] > N:
valid = False
break
if valid == False:
print('-1')
else:
for i in output:
print(i)
print(' ')
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
2892 KB |
Output is correct |
2 |
Correct |
14 ms |
2900 KB |
Output is correct |
3 |
Correct |
14 ms |
2892 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
2892 KB |
Output is correct |
2 |
Correct |
14 ms |
2900 KB |
Output is correct |
3 |
Correct |
14 ms |
2892 KB |
Output is correct |
4 |
Correct |
13 ms |
2892 KB |
Output is correct |
5 |
Correct |
13 ms |
2892 KB |
Output is correct |
6 |
Correct |
16 ms |
2904 KB |
Output is correct |
7 |
Correct |
13 ms |
2892 KB |
Output is correct |
8 |
Correct |
15 ms |
2900 KB |
Output is correct |
9 |
Correct |
16 ms |
2892 KB |
Output is correct |
10 |
Correct |
13 ms |
2892 KB |
Output is correct |
11 |
Correct |
14 ms |
2892 KB |
Output is correct |
12 |
Correct |
13 ms |
2796 KB |
Output is correct |
13 |
Correct |
13 ms |
2896 KB |
Output is correct |
14 |
Incorrect |
13 ms |
2892 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
2892 KB |
Output is correct |
2 |
Correct |
14 ms |
2900 KB |
Output is correct |
3 |
Correct |
14 ms |
2892 KB |
Output is correct |
4 |
Correct |
13 ms |
2892 KB |
Output is correct |
5 |
Correct |
13 ms |
2892 KB |
Output is correct |
6 |
Correct |
16 ms |
2904 KB |
Output is correct |
7 |
Correct |
13 ms |
2892 KB |
Output is correct |
8 |
Correct |
15 ms |
2900 KB |
Output is correct |
9 |
Correct |
16 ms |
2892 KB |
Output is correct |
10 |
Correct |
13 ms |
2892 KB |
Output is correct |
11 |
Correct |
14 ms |
2892 KB |
Output is correct |
12 |
Correct |
13 ms |
2796 KB |
Output is correct |
13 |
Correct |
13 ms |
2896 KB |
Output is correct |
14 |
Incorrect |
13 ms |
2892 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
605 ms |
22964 KB |
Output is correct |
2 |
Correct |
13 ms |
2892 KB |
Output is correct |
3 |
Correct |
797 ms |
41448 KB |
Output is correct |
4 |
Correct |
326 ms |
10736 KB |
Output is correct |
5 |
Correct |
451 ms |
26332 KB |
Output is correct |
6 |
Correct |
484 ms |
30020 KB |
Output is correct |
7 |
Correct |
396 ms |
20468 KB |
Output is correct |
8 |
Correct |
406 ms |
20664 KB |
Output is correct |
9 |
Correct |
12 ms |
2892 KB |
Output is correct |
10 |
Correct |
14 ms |
2972 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
2892 KB |
Output is correct |
2 |
Correct |
14 ms |
2900 KB |
Output is correct |
3 |
Correct |
14 ms |
2892 KB |
Output is correct |
4 |
Correct |
13 ms |
2892 KB |
Output is correct |
5 |
Correct |
13 ms |
2892 KB |
Output is correct |
6 |
Correct |
16 ms |
2904 KB |
Output is correct |
7 |
Correct |
13 ms |
2892 KB |
Output is correct |
8 |
Correct |
15 ms |
2900 KB |
Output is correct |
9 |
Correct |
16 ms |
2892 KB |
Output is correct |
10 |
Correct |
13 ms |
2892 KB |
Output is correct |
11 |
Correct |
14 ms |
2892 KB |
Output is correct |
12 |
Correct |
13 ms |
2796 KB |
Output is correct |
13 |
Correct |
13 ms |
2896 KB |
Output is correct |
14 |
Incorrect |
13 ms |
2892 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |