Submission #44398719


Source Code Expand

use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    };
    let mut vec = 0_i64;
    let mut vec_max = 0_i64;
    let mut cur = 0_i64;
    let mut max = 0_i64;
    for a_i in a {
        vec += a_i;
        vec_max = vec_max.max(vec);
        max = max.max(cur + vec_max);
        cur += vec;
    }
    let ans = max;
    println!("{}", ans);
}

Submission Info

Submission Time
Task D - Wandering
User bouzuya
Language Rust (1.42.0)
Score 400
Code Size 382 Byte
Status AC
Exec Time 29 ms
Memory 5500 KiB

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 29 ms 5244 KiB
around0_01.txt AC 18 ms 5220 KiB
around0_02.txt AC 24 ms 5276 KiB
around0_03.txt AC 11 ms 3544 KiB
around0_04.txt AC 3 ms 2200 KiB
around0_05.txt AC 18 ms 4608 KiB
extreme_00.txt AC 19 ms 5368 KiB
extreme_01.txt AC 19 ms 5500 KiB
handmade_00.txt AC 1 ms 2140 KiB
handmade_01.txt AC 1 ms 1996 KiB
random_00.txt AC 21 ms 5216 KiB
random_01.txt AC 18 ms 5296 KiB
random_02.txt AC 24 ms 5268 KiB
random_03.txt AC 18 ms 5328 KiB
random_04.txt AC 7 ms 2224 KiB
random_05.txt AC 19 ms 4672 KiB
random_06.txt AC 2 ms 2176 KiB
random_07.txt AC 14 ms 4060 KiB
sample_01.txt AC 1 ms 1900 KiB
sample_02.txt AC 1 ms 2116 KiB
sample_03.txt AC 2 ms 2048 KiB