Submission #4033379
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 np.sign(sum)*np.sign(sum+c)>=0: count += np.abs(sum+c)+1 sum = -1 * np.sign(sum) else: sum=sum+c if np.sign(sum2) * np.sign(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 | 637 Byte |
Status | WA |
Exec Time | 2109 ms |
Memory | 21244 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 | 379 ms | 18572 KB |
00-01.txt | AC | 149 ms | 12472 KB |
00-02.txt | AC | 148 ms | 12468 KB |
01-00.txt | TLE | 2109 ms | 20192 KB |
01-01.txt | TLE | 2109 ms | 20272 KB |
01-02.txt | TLE | 2108 ms | 21020 KB |
01-03.txt | TLE | 2090 ms | 19500 KB |
01-04.txt | TLE | 2109 ms | 19256 KB |
01-05.txt | TLE | 2109 ms | 18520 KB |
01-06.txt | TLE | 2088 ms | 19796 KB |
01-07.txt | AC | 1935 ms | 19016 KB |
01-08.txt | TLE | 2109 ms | 20112 KB |
01-09.txt | TLE | 2108 ms | 20352 KB |
01-10.txt | AC | 1571 ms | 17852 KB |
01-11.txt | TLE | 2109 ms | 19964 KB |
01-12.txt | TLE | 2109 ms | 20168 KB |
01-13.txt | WA | 1947 ms | 21244 KB |
01-14.txt | TLE | 2108 ms | 21192 KB |