結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー cra77756176cra77756176
提出日時 2022-12-06 22:53:18
言語 Rust
(1.77.0)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 594 bytes
コンパイル時間 1,966 ms
コンパイル使用メモリ 162,560 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 11:50:21
合計ジャッジ時間 3,144 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

use std::collections::HashMap;

fn main() {
    let mut cc = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut cc).ok();
    let cc: Vec<u64> = cc
        .split_whitespace()
        .skip(1)
        .map(|n| n.parse().unwrap())
        .collect();

    let mut votes = HashMap::new();

    for c in cc {
        *votes.entry(c).or_insert(0) += 1;
    }

    let max = votes.values().max().unwrap();
    let answer = votes
        .iter()
        .filter(|&(_, v)| v == max)
        .map(|(k, _)| k)
        .max()
        .unwrap();

    println!("{:?}", answer);
}
0