結果

問題 No.1390 Get together
ユーザー tonyu0
提出日時 2021-02-12 22:31:27
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 733 bytes
コンパイル時間 13,523 ms
コンパイル使用メモリ 377,272 KB
実行使用メモリ 15,104 KB
最終ジャッジ日時 2024-07-19 23:09:51
合計ジャッジ時間 13,940 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;

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 _: usize = itr.next().unwrap().parse().unwrap();
    let mut col: Vec<Vec<usize>> = vec![vec![]; n];
    for _ in 0..n {
        let b = itr.next().unwrap().parse::<usize>().unwrap() - 1;
        let c = itr.next().unwrap().parse::<usize>().unwrap() - 1;
        col[c].push(b);
    }

    let mut ans = 0;
    for i in 0..n {
        if col[i].len() == 0 {
            continue;
        }
        col[i].sort();
        col[i].dedup();
        ans += col[i].len() - 1;
    }
    println!("{}", ans);
}
0