結果

問題 No.182 新規性の虜
コンテスト
ユーザー cra77756176
提出日時 2022-11-28 22:04:38
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 5 ms / 5,000 ms
+ 991µs
コード長 541 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,620 ms
コンパイル使用メモリ 189,676 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-10 20:18:56
合計ジャッジ時間 3,834 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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