Submission #4033390
Source Code Expand
from operator import itemgetter import numpy as np N = int(input()) sum=0 sum2=0 count=0 count2=0 s = input().split() for i in range(N): c = int(s[i]) if i==0: sum=c count2=np.abs(c+1) sum2=np.sign(c)*(-1) else: if sum*(sum+c)>=0: count += np.abs(sum+c)+1 sum = -1 * np.sign(sum) else: sum=sum+c if sum2 * (sum2 + c) >= 0: count2 += np.abs(sum2 + c) + 1 sum2 = -1 * np.sign(sum2) else: sum2 = sum2 + c print(min(count,count2))
Submission Info
Submission Time | |
---|---|
Task | C - Sequence |
User | kakkey1964 |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 605 Byte |
Status | WA |
Exec Time | 2109 ms |
Memory | 21248 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 | 149 ms | 12276 KB |
00-01.txt | AC | 149 ms | 12260 KB |
00-02.txt | AC | 149 ms | 12388 KB |
01-00.txt | AC | 1470 ms | 21248 KB |
01-01.txt | WA | 1926 ms | 20316 KB |
01-02.txt | WA | 1471 ms | 19840 KB |
01-03.txt | WA | 1430 ms | 19532 KB |
01-04.txt | WA | 1755 ms | 19248 KB |
01-05.txt | WA | 1525 ms | 20400 KB |
01-06.txt | AC | 1475 ms | 19840 KB |
01-07.txt | AC | 1299 ms | 19076 KB |
01-08.txt | AC | 1503 ms | 20156 KB |
01-09.txt | WA | 1887 ms | 19244 KB |
01-10.txt | AC | 1082 ms | 17896 KB |
01-11.txt | AC | 1460 ms | 19872 KB |
01-12.txt | TLE | 2109 ms | 21196 KB |
01-13.txt | WA | 1406 ms | 19168 KB |
01-14.txt | AC | 1518 ms | 20168 KB |