結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー phsplsphspls
提出日時 2020-01-31 23:40:26
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 994 bytes
コンパイル時間 2,225 ms
コンパイル使用メモリ 189,324 KB
実行使用メモリ 8,020 KB
最終ジャッジ日時 2023-10-17 13:02:52
合計ジャッジ時間 2,645 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 WA -
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 WA -
testcase_17 AC 3 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 9 ms
4,508 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 26 ms
8,020 KB
testcase_24 AC 26 ms
8,020 KB
testcase_25 AC 26 ms
8,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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");
        }
    }
}
0