結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー wesrivery
提出日時 2019-06-22 14:29:44
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 1,150 bytes
コンパイル時間 16,276 ms
コンパイル使用メモリ 378,640 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 08:59:09
合計ジャッジ時間 17,621 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#[allow(unused_macros)]
macro_rules! invec {
    ( $t:ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s.trim().split_whitespace().map(|s| s.parse::<$t>().unwrap()).collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }}
}

#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($(
            {
                 splits.next().unwrap().parse::<$t>().unwrap()
            },
        )*)
    }}
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (n, ) = input!(usize);
    let ls = invec!(usize);

    let mut level_count = vec![0; 6];

    for l in ls {
        level_count[l-1] += 1;
    }

    let mut max = 0;
    let mut max_index = 0;
    for i in 0..6 {
        if max <= level_count[i] {
            max_index = i;
            max = level_count[i]
        }
    }

    println!("{}", max_index + 1);
}

fn main() {
    solve();
}
0