結果
問題 | No.24 数当てゲーム |
ユーザー |
![]() |
提出日時 | 2022-11-18 01:14:03 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 802 bytes |
コンパイル時間 | 21,499 ms |
コンパイル使用メモリ | 403,740 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 11:30:50 |
合計ジャッジ時間 | 13,240 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
use std::{ collections::HashSet, io::{self, BufRead}, }; fn main() { let input = io::stdin() .lock() .lines() .map(|l| { l.unwrap() .split(' ') .map(std::string::ToString::to_string) .collect::<Vec<_>>() }) .collect::<Vec<_>>(); let mut possible = (0..=9).collect::<HashSet<_>>(); input[1..].iter().for_each(|l| { let numbers = l[..4] .iter() .map(|n| n.parse::<usize>().unwrap()) .collect::<HashSet<_>>(); if l[4] == "YES" { possible.retain(|n| numbers.contains(n)); } else { possible.retain(|n| !numbers.contains(n)); } }); println!("{}", possible.iter().next().unwrap()); }