結果
問題 | No.305 鍵(2) |
ユーザー | aimy |
提出日時 | 2017-11-29 12:49:29 |
言語 | Rust (1.77.0 + proconio) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,062 bytes |
コンパイル時間 | 11,410 ms |
コンパイル使用メモリ | 401,840 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 40.54 |
最終ジャッジ日時 | 2024-07-16 14:53:22 |
合計ジャッジ時間 | 14,155 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | AC | 22 ms
25,220 KB |
testcase_02 | RE | - |
testcase_03 | AC | 21 ms
24,836 KB |
testcase_04 | AC | 23 ms
24,964 KB |
testcase_05 | AC | 22 ms
24,580 KB |
testcase_06 | AC | 22 ms
24,964 KB |
testcase_07 | RE | - |
testcase_08 | AC | 21 ms
24,580 KB |
testcase_09 | AC | 22 ms
25,476 KB |
testcase_10 | AC | 22 ms
24,836 KB |
testcase_11 | AC | 24 ms
25,220 KB |
testcase_12 | AC | 22 ms
24,580 KB |
コンパイルメッセージ
warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:59:9 | 59 | buf.trim_right().parse::<T>().ok().unwrap() | ^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated method | 59 | buf.trim_end().parse::<T>().ok().unwrap() | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:74:22 | 74 | let mut it = buf.trim_right().split_whitespace(); | ^^^^^^^^^^ | help: replace the use of the deprecated method | 74 | let mut it = buf.trim_end().split_whitespace(); | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:92:22 | 92 | let mut it = buf.trim_right().split_whitespace(); | ^^^^^^^^^^ | help: replace the use of the deprecated method | 92 | let mut it = buf.trim_end().split_whitespace(); | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:111:9 | 111 | buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() | ^^^^^^^^^^ | help: replace the use of the deprecated method | 111 | buf.trim_end().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:126:9 | 126 | buf.trim_right().chars().collect() | ^^^^^^^^^^ | help: replace the use of the deprecated method | 126 | buf.trim_end().chars().collect() | ~~~~~~~~
ソースコード
#[allow(unused_macros)] macro_rules! debug { ($($e:expr), *) => {println!(concat!($(stringify!($e), " = {:?}\n"), *), $($e), *)} } fn main() { let mut cand = vec![0; 10]; let mut r0 = score(&cand); for i in 0 .. 10 { for k in 1 .. 10 { cand[i] = k; let r = score(&cand); if r < r0 { break } else if r > r0 { r0 += 1; break } } } unreachable!() } fn score(cand: &Vec<usize>) -> usize { put::vec(cand, ""); let rs = get::val::<String>(); let ret = rs.split_whitespace().next().unwrap().parse().ok().unwrap(); if ret == 10 {std::process::exit(0)} ret } #[allow(dead_code)] mod put { use std::string::*; pub fn vec<T: ToString>(vec: &Vec<T>, sep: &str) { let out = vec.iter().map(|e| e.to_string()).collect::<Vec<_>>().as_slice().join(sep); println!("{}", out); } pub fn mat<T: ToString>(mat: &Vec<Vec<T>>, sep: &str) { for v in mat { vec(v, sep); } } } #[allow(dead_code)] mod get { use std::io::*; use std::str::*; pub fn val<T: FromStr>() -> T { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().parse::<T>().ok().unwrap() } pub fn vals<T: FromStr>(n: usize) -> Vec<T> { let mut vec: Vec<T> = vec![]; for _ in 0 .. n { vec.push(val()); } vec } pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::<T1>().ok().unwrap(); let y = it.next().unwrap().parse::<T2>().ok().unwrap(); (x, y) } pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> { let mut vec: Vec<(T1, T2)> = vec![]; for _ in 0 .. n { vec.push(tuple()); } vec } pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::<T1>().ok().unwrap(); let y = it.next().unwrap().parse::<T2>().ok().unwrap(); let z = it.next().unwrap().parse::<T3>().ok().unwrap(); (x, y, z) } pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> { let mut vec: Vec<(T1, T2, T3)> = vec![]; for _ in 0 .. n { vec.push(tuple3()); } vec } pub fn list<T: FromStr>() -> Vec<T> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() } pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> { let mut mat: Vec<Vec<T>> = vec![]; for _ in 0 .. h { mat.push(list()); } mat } pub fn chars() -> Vec<char> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().chars().collect() } }