# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
501156 |
2022-01-02T13:39:43 Z |
MrVroom999 |
Nizin (COCI16_nizin) |
Python 3 |
|
836 ms |
30512 KB |
"""
COCI 2016/2017 Round 2
Given an array of integers [a1, a2, ... an]
perform an operation that combines a1 and a2
or combines an and an-1
Find minimum operations such that array is
a palindrome
"""
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)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
2764 KB |
Output is correct |
2 |
Correct |
13 ms |
2744 KB |
Output is correct |
3 |
Correct |
13 ms |
2764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
2832 KB |
Output is correct |
2 |
Correct |
12 ms |
2776 KB |
Output is correct |
3 |
Correct |
15 ms |
2764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
2764 KB |
Output is correct |
2 |
Correct |
12 ms |
2740 KB |
Output is correct |
3 |
Correct |
12 ms |
2764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
2836 KB |
Output is correct |
2 |
Correct |
16 ms |
2824 KB |
Output is correct |
3 |
Correct |
12 ms |
2764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
2764 KB |
Output is correct |
2 |
Correct |
14 ms |
2768 KB |
Output is correct |
3 |
Correct |
15 ms |
2748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
2764 KB |
Output is correct |
2 |
Correct |
13 ms |
2844 KB |
Output is correct |
3 |
Correct |
13 ms |
2852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
4796 KB |
Output is correct |
2 |
Correct |
104 ms |
5328 KB |
Output is correct |
3 |
Correct |
105 ms |
5156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
280 ms |
11864 KB |
Output is correct |
2 |
Correct |
353 ms |
14636 KB |
Output is correct |
3 |
Correct |
432 ms |
16616 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
599 ms |
22792 KB |
Output is correct |
2 |
Correct |
636 ms |
23828 KB |
Output is correct |
3 |
Correct |
668 ms |
26084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
798 ms |
30420 KB |
Output is correct |
2 |
Correct |
756 ms |
30356 KB |
Output is correct |
3 |
Correct |
836 ms |
30512 KB |
Output is correct |