N = int(input())
arr = list(map(int, input().split()))
k, i, j = 0, 0, N - 1
while i < j:
if arr[i] == arr[j]:
i += 1
j -= 1
elif arr[i] < arr[j]:
arr[i + 1] += arr[i]
i += 1
k += 1
else:
arr[j - 1] += arr[j]
j -= 1
k += 1
print(k)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
18228 KB |
Output is correct |
2 |
Correct |
38 ms |
18192 KB |
Output is correct |
3 |
Correct |
33 ms |
18212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
18192 KB |
Output is correct |
2 |
Correct |
35 ms |
18212 KB |
Output is correct |
3 |
Correct |
34 ms |
18228 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
18340 KB |
Output is correct |
2 |
Correct |
33 ms |
18104 KB |
Output is correct |
3 |
Correct |
37 ms |
18196 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
37 ms |
18176 KB |
Output is correct |
2 |
Correct |
33 ms |
18128 KB |
Output is correct |
3 |
Correct |
37 ms |
18204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
37 ms |
18180 KB |
Output is correct |
2 |
Correct |
36 ms |
18152 KB |
Output is correct |
3 |
Correct |
38 ms |
18196 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
18148 KB |
Output is correct |
2 |
Correct |
39 ms |
18212 KB |
Output is correct |
3 |
Correct |
39 ms |
18160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
70 ms |
26128 KB |
Output is correct |
2 |
Correct |
58 ms |
30840 KB |
Output is correct |
3 |
Correct |
59 ms |
30096 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
105 ms |
54592 KB |
Output is correct |
2 |
Correct |
136 ms |
62836 KB |
Output is correct |
3 |
Runtime error |
120 ms |
65536 KB |
Execution killed with signal 9 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
139 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
144 ms |
65540 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |