結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー atcoder8atcoder8
提出日時 2023-08-04 21:30:40
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 1,250 bytes
コンパイル時間 13,235 ms
コンパイル使用メモリ 377,908 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-14 19:27:44
合計ジャッジ時間 14,941 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let n = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse::<usize>().unwrap()
    };
    let _m1 = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse::<usize>().unwrap()
    };
    let aa: Vec<_> = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse::<usize>().unwrap())
            .collect()
    };
    let _m2 = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse::<usize>().unwrap()
    };
    let bb: Vec<_> = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse::<usize>().unwrap())
            .collect()
    };

    let mut visited = vec![false; n + 1];
    let mut cur = 0;
    for &a in &aa {
        cur += a;
        visited[cur] = true;
    }
    for &b in &bb {
        cur -= b;
        visited[cur] = true;
    }

    let ans = visited.iter().filter(|&&x| !x).count();
    println!("{}", ans);
}
0