結果

問題 No.182 新規性の虜
コンテスト
ユーザー cra77756176
提出日時 2022-11-28 22:04:38
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 541 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,268 ms
コンパイル使用メモリ 196,828 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-21 07:48:50
合計ジャッジ時間 5,654 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use std::{collections::HashSet, io};

fn main() {
    io::stdin().read_line(&mut String::new()).ok();
    let mut a = String::new();
    io::stdin().read_line(&mut a).ok();
    let mut a = a
        .split_whitespace()
        .map(|n| n.parse::<u64>().unwrap())
        .collect::<Vec<_>>();

    a.sort_unstable();

    let duplicates = a
        .windows(2)
        .filter_map(|n| if n[0] == n[1] { Some(n[0]) } else { None })
        .collect::<HashSet<_>>();

    a.retain(|n| !duplicates.contains(n));

    println!("{}", a.len());
}
0