結果

問題 No.975 ミスターマックスバリュ
ユーザー omgitskuuomgitskuu
提出日時 2020-03-20 20:46:48
言語 Rust
(1.77.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 726 bytes
コンパイル時間 3,619 ms
コンパイル使用メモリ 163,992 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-21 11:13:06
合計ジャッジ時間 2,234 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 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 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `n`
  --> Main.rs:10:13
   |
10 |     let (x, n, m) = (a[0],a[1],a[2]);
   |             ^ help: if this is intentional, prefix it with an underscore: `_n`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `m`
  --> Main.rs:10:16
   |
10 |     let (x, n, m) = (a[0],a[1],a[2]);
   |                ^ help: if this is intentional, prefix it with an underscore: `_m`

warning: variable does not need to be mutable
 --> Main.rs:9:9
  |
9 |     let mut a :Vec<i32> = read_vec(); 
  |         ----^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

warning: variable does not need to be mutable
  --> Main.rs:11:9
   |
11 |     let mut mt_max: HashSet<i32> = read_vec().into_iter().collect();
   |         ----^^^^^^
   |         |
   |         help: remove this `mut`

warning: variable does not need to be mutable
  --> Main.rs:12:9
   |
12 |     let mut max_value: HashSet<i32> = read_vec().into_iter().collect(); 
   |         ----^^^^^^^^^
   |         |
   |         help: remove this `mut`

warning: 5 warnings emitted

ソースコード

diff #

use std::collections::HashSet;
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
      .map(|e| e.parse().ok().unwrap()).collect()
}
fn main(){
    let mut a :Vec<i32> = read_vec(); 
    let (x, n, m) = (a[0],a[1],a[2]);
    let mut mt_max: HashSet<i32> = read_vec().into_iter().collect();
    let mut max_value: HashSet<i32> = read_vec().into_iter().collect(); 
    if mt_max.contains(&x) && max_value.contains(&x)
    { println!("MrMaxValu");  } else if mt_max.contains(&x)
    {
     println!("MrMax");    
    }
    else if max_value.contains(&x){
        println!("MaxValu"); 
    }else{ println!("{}", -1);  }
  
}
0