結果

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

ソースコード

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; n];

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

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

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

fn main() {
    solve();
}
0