Submission #15528533


Source Code Expand

Copy
use proconio::input;
use proconio::marker::Usize1;

fn main() {
    input! {
        n: usize,
        a: [Usize1; n],
        b: [i64; n],
        c: [i64; n - 1],
    };
    let mut ans = 0_i64;
    let mut p = None;
    for &a_i in a.iter() {
        ans += b[a_i];
        if let Some(i_p) = p {
            if a_i == i_p + 1 {
                ans += c[i_p];
            }
        }
        p = Some(a_i);
    }
    println!("{}", ans);
}

Submission Info

Submission Time
Task B - Buffet
User bouzuya
Language Rust (1.42.0)
Score 200
Code Size 443 Byte
Status
Exec Time 5 ms
Memory 2128 KB

Judge Result

Set Name Score / Max Score Test Cases
All 200 / 200 sample_01, sample_02, sample_03, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10
Sample 0 / 0 sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
sample_01 3 ms 1888 KB
sample_02 2 ms 2060 KB
sample_03 2 ms 1972 KB
testcase_01 4 ms 1952 KB
testcase_02 1 ms 2024 KB
testcase_03 2 ms 1964 KB
testcase_04 2 ms 2008 KB
testcase_05 2 ms 2048 KB
testcase_06 2 ms 2084 KB
testcase_07 5 ms 2040 KB
testcase_08 2 ms 2128 KB
testcase_09 2 ms 2016 KB
testcase_10 2 ms 1972 KB