結果
問題 | No.975 ミスターマックスバリュ |
ユーザー |
![]() |
提出日時 | 2020-03-20 20:46:48 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 726 bytes |
コンパイル時間 | 13,818 ms |
コンパイル使用メモリ | 400,788 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-14 21:52:18 |
合計ジャッジ時間 | 14,916 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 |
コンパイルメッセージ
warning: unused variable: `n` --> src/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` --> src/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 --> src/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 --> src/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 --> src/main.rs:12:9 | 12 | let mut max_value: HashSet<i32> = read_vec().into_iter().collect(); | ----^^^^^^^^^ | | | help: remove this `mut`
ソースコード
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); } }