結果
問題 |
No.182 新規性の虜
|
ユーザー |
![]() |
提出日時 | 2022-11-28 22:04:38 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 10 ms / 5,000 ms |
コード長 | 541 bytes |
コンパイル時間 | 14,388 ms |
コンパイル使用メモリ | 378,708 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-05 23:02:22 |
合計ジャッジ時間 | 15,855 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
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()); }