結果

問題 No.806 木を道に
コンテスト
ユーザー cra77756176
提出日時 2022-12-17 19:50:04
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 384 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 12,489 ms
コンパイル使用メモリ 194,056 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-12 06:08:31
合計ジャッジ時間 9,698 ms
ジャッジサーバーID
(参考情報)
judge2_1 / tmp-judge_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let mut xx = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok();
    let xx: Vec<usize> = xx.split_whitespace().flat_map(str::parse).collect();

    let mut count = vec![0; xx[0] + 1];
    for &n in &xx[1..] {
        count[n] += 1;
    }

    let answer = count.iter().filter(|&&n| n == 1).count() - 2;

    println!("{answer}");
}
0