結果
問題 | No.79 過小評価ダメ・ゼッタイ |
ユーザー |
![]() |
提出日時 | 2017-07-22 14:29:46 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 735 bytes |
コンパイル時間 | 13,339 ms |
コンパイル使用メモリ | 403,820 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 08:16:17 |
合計ジャッジ時間 | 14,514 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
warning: unused import: `LinkedList` --> src/main.rs:3:33 | 3 | use std::collections::{HashMap, LinkedList}; | ^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused variable: `m` --> src/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
ソースコード
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); }