Submission #15528560


Source Code Expand

Copy
use proconio::input;

fn main() {
    input! {
        n: usize,
        b: [i64; n - 1],
    };
    let mut ans = b[0] + b[n - 1 - 1];
    for (b_i0, b_i1) in b.windows(2).map(|w| match w {
        &[b_i0, b_i1] => (b_i0, b_i1),
        _ => unreachable!(),
    }) {
        ans += std::cmp::min(b_i0, b_i1);
    }
    println!("{}", ans);
}

Submission Info

Submission Time
Task C - Maximal Value
User bouzuya
Language Rust (1.42.0)
Score 300
Code Size 343 Byte
Status
Exec Time 8 ms
Memory 2116 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample00, sample01, sample02
All 300 / 300 handmade03, handmade04, handmade05, handmade06, handmade07, handmade08, handmade09, random10, random11, random12, random13, random14, sample00, sample01, sample02
Case Name Status Exec Time Memory
handmade03 8 ms 2000 KB
handmade04 2 ms 2076 KB
handmade05 1 ms 2032 KB
handmade06 1 ms 2080 KB
handmade07 1 ms 2112 KB
handmade08 2 ms 2112 KB
handmade09 2 ms 2052 KB
random10 2 ms 2116 KB
random11 1 ms 2044 KB
random12 1 ms 2088 KB
random13 3 ms 2100 KB
random14 2 ms 2048 KB
sample00 1 ms 2052 KB
sample01 2 ms 2060 KB
sample02 1 ms 2080 KB