Submission #1959736
Source Code Expand
N = int(input()) A = list(map(int, input().split())) def func(A, plus): total = 0 ans = 0 if A[0] == 0: total = 1 if plus else -1 ans = 1 for a in A[ans:]: t = total + a if t != 0 and total * t <= 0: total = t continue ans += abs(t)+1 total = -1 if total > 0 else 1 return ans print(min(func(A, True), func(A, False)))
Submission Info
Submission Time | |
---|---|
Task | C - Sequence |
User | espressivosubito |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 384 Byte |
Status | WA |
Exec Time | 91 ms |
Memory | 14332 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00-00.txt, 00-01.txt, 00-02.txt |
All | 00-00.txt, 00-01.txt, 00-02.txt, 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00-00.txt | AC | 17 ms | 3064 KB |
00-01.txt | AC | 17 ms | 3064 KB |
00-02.txt | AC | 17 ms | 3064 KB |
01-00.txt | WA | 91 ms | 14212 KB |
01-01.txt | AC | 89 ms | 14332 KB |
01-02.txt | WA | 87 ms | 13784 KB |
01-03.txt | WA | 84 ms | 13284 KB |
01-04.txt | AC | 81 ms | 12764 KB |
01-05.txt | AC | 76 ms | 11884 KB |
01-06.txt | WA | 87 ms | 13676 KB |
01-07.txt | AC | 82 ms | 12552 KB |
01-08.txt | AC | 89 ms | 14332 KB |
01-09.txt | AC | 83 ms | 12768 KB |
01-10.txt | WA | 70 ms | 11068 KB |
01-11.txt | AC | 89 ms | 13784 KB |
01-12.txt | AC | 90 ms | 14208 KB |
01-13.txt | WA | 81 ms | 13136 KB |
01-14.txt | AC | 90 ms | 14212 KB |