結果
問題 |
No.977 アリス仕掛けの摩天楼
|
ユーザー |
|
提出日時 | 2020-01-31 23:40:26 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 994 bytes |
コンパイル時間 | 13,153 ms |
コンパイル使用メモリ | 383,188 KB |
実行使用メモリ | 8,052 KB |
最終ジャッジ日時 | 2024-09-17 11:06:08 |
合計ジャッジ時間 | 14,559 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 8 |
ソースコード
use std::io::Read; use std::collections::HashMap; fn main() { let mut all_data = String::new(); std::io::stdin().read_to_string(&mut all_data).ok(); let all_data: Vec<&str> = all_data.trim().split('\n').map(|s| s.trim()).collect(); let n: usize = all_data.iter().next().unwrap().parse().unwrap(); let mut lsland2bridges: HashMap<usize, usize> = HashMap::new(); all_data.iter().skip(1).take(n).for_each(|s| { s.split_whitespace().map(|i| i.parse::<usize>().unwrap()).for_each(|a| { if let Some(x) = lsland2bridges.get_mut(&a) { *x += 1; } else { lsland2bridges.insert(a, 1); } }); }); if lsland2bridges.len() == n { println!("Bob"); } else if lsland2bridges.len() + 1 < n { println!("Alice"); } else { if lsland2bridges.values().min().unwrap() == &1 { println!("Alice"); } else { println!("Bob"); } } }