結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー 💕💖💞💕💖💞
提出日時 2017-07-22 14:29:46
言語 Rust
(1.77.0)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 1,769 ms
コンパイル使用メモリ 152,700 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-08 15:12:32
合計ジャッジ時間 3,031 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 5 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 4 ms
4,380 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 5 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 4 ms
4,376 KB
testcase_24 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `LinkedList`
 --> Main.rs:3:33
  |
3 | use std::collections::{HashMap, LinkedList};
  |                                 ^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `m`
 --> Main.rs:8:7
  |
8 |   let m = line.parse::<i32>().unwrap();
  |       ^ help: if this is intentional, prefix it with an underscore: `_m`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 2 warnings emitted

ソースコード

diff #

use std::io::{self, BufRead};
use std::collections::{HashMap, LinkedList};

fn main() {
  let stdin = io::stdin();
  let line = stdin.lock().lines().next().unwrap().unwrap();
  let m = line.parse::<i32>().unwrap();
 
  let line = stdin.lock().lines().next().unwrap().unwrap();
  let iter = line.split_whitespace();
  let mut v:Vec<i32> = Vec::new();

  for e in iter { 
    let b = (*e).parse::<i32>().unwrap();
    v.push( b );
  }
  
  let mut ii:HashMap<i32, i32> = HashMap::new();
  for i in v {
    *ii.entry(i).or_insert(0) += 10;
  }
  let mut tmp1:i32 = 0;
  let mut tmp2:i32 = 0;
  for (k, v) in ii.iter() {
    if tmp1 < *v || (tmp2 < *k && tmp1 == *v) {
      tmp2 = *k;
      tmp1 = *v;
    }
  }
  println!("{}", tmp2);
}
0