結果

問題 No.29 パワーアップ
コンテスト
ユーザー tonyu0
提出日時 2019-12-15 22:47:43
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 698 bytes
コンパイル時間 11,375 ms
コンパイル使用メモリ 397,948 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-24 21:12:41
合計ジャッジ時間 12,185 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut cnt = vec![0; 11];
    for _ in 0..n {
        let a: usize = itr.next().unwrap().parse().unwrap();
        let b: usize = itr.next().unwrap().parse().unwrap();
        let c: usize = itr.next().unwrap().parse().unwrap();
        cnt[a] += 1;
        cnt[b] += 1;
        cnt[c] += 1;
    }

    let mut ans = 0;
    let mut rem = 0;
    for i in 1..11 {
        ans += cnt[i] / 2;
        rem += cnt[i] % 2;
    }
    ans += rem / 4;
    println!("{}", ans);
}
0