Submission #17966064


Source Code Expand

Copy
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def from_read(dtype=np.int64):
    return np.fromstring(read().decode(), dtype=dtype, sep=' ')


def from_readline(dtype=np.int64):
    return np.fromstring(readline().decode(), dtype=dtype, sep=' ')

def main(A):
    N = len(A)
    Acum = np.zeros(N + 1, np.int64)
    Acum[1:] = np.cumsum(A)
    X = np.cumsum(Acum)
    Acum_max = np.maximum.accumulate(Acum)
    ans = np.max(X[:-1] + Acum_max[1:])
    return ans

A = from_read()[1:]

print(main(A))

Submission Info

Submission Time
Task D - Wandering
User maspy
Language Python (3.8.2)
Score 400
Code Size 614 Byte
Status AC
Exec Time 123 ms
Memory 34512 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 21
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All around0_00.txt, around0_01.txt, around0_02.txt, around0_03.txt, around0_04.txt, around0_05.txt, extreme_00.txt, extreme_01.txt, handmade_00.txt, handmade_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
around0_00.txt AC 123 ms 34280 KB
around0_01.txt AC 116 ms 34240 KB
around0_02.txt AC 117 ms 34336 KB
around0_03.txt AC 110 ms 29764 KB
around0_04.txt AC 103 ms 27148 KB
around0_05.txt AC 114 ms 32380 KB
extreme_00.txt AC 114 ms 34300 KB
extreme_01.txt AC 114 ms 34420 KB
handmade_00.txt AC 105 ms 27080 KB
handmade_01.txt AC 106 ms 26932 KB
random_00.txt AC 116 ms 34424 KB
random_01.txt AC 117 ms 34512 KB
random_02.txt AC 116 ms 34324 KB
random_03.txt AC 117 ms 34288 KB
random_04.txt AC 103 ms 27240 KB
random_05.txt AC 115 ms 32768 KB
random_06.txt AC 104 ms 27204 KB
random_07.txt AC 113 ms 31352 KB
sample_01.txt AC 106 ms 27072 KB
sample_02.txt AC 106 ms 27080 KB
sample_03.txt AC 105 ms 26756 KB