結果
問題 | No.115 遠足のおやつ |
ユーザー | aimy |
提出日時 | 2017-12-27 23:42:52 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,725 bytes |
コンパイル時間 | 15,212 ms |
コンパイル使用メモリ | 392,656 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-01 05:15:02 |
合計ジャッジ時間 | 15,669 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | WA | - |
testcase_02 | AC | 1 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,944 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 1 ms
6,940 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 1 ms
6,944 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | AC | 2 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,944 KB |
testcase_20 | AC | 2 ms
6,944 KB |
testcase_21 | AC | 1 ms
6,940 KB |
testcase_22 | AC | 1 ms
6,944 KB |
testcase_23 | WA | - |
testcase_24 | AC | 2 ms
6,944 KB |
testcase_25 | AC | 1 ms
6,940 KB |
testcase_26 | AC | 1 ms
6,944 KB |
testcase_27 | AC | 1 ms
6,944 KB |
testcase_28 | AC | 1 ms
6,944 KB |
testcase_29 | AC | 1 ms
6,944 KB |
testcase_30 | AC | 1 ms
6,940 KB |
testcase_31 | AC | 1 ms
6,944 KB |
testcase_32 | AC | 1 ms
6,944 KB |
testcase_33 | AC | 1 ms
6,940 KB |
testcase_34 | AC | 1 ms
6,940 KB |
testcase_35 | AC | 1 ms
6,940 KB |
testcase_36 | AC | 1 ms
6,940 KB |
testcase_37 | AC | 1 ms
6,944 KB |
testcase_38 | AC | 1 ms
6,940 KB |
testcase_39 | WA | - |
testcase_40 | AC | 1 ms
6,940 KB |
testcase_41 | AC | 1 ms
6,944 KB |
testcase_42 | AC | 1 ms
6,944 KB |
コンパイルメッセージ
warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:49:9 | 49 | buf.trim_right().parse::<T>().ok().unwrap() | ^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated method | 49 | 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:65:22 | 65 | let mut it = buf.trim_right().split_whitespace(); | ^^^^^^^^^^ | help: replace the use of the deprecated method | 65 | 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:84:22 | 84 | let mut it = buf.trim_right().split_whitespace(); | ^^^^^^^^^^ | help: replace the use of the deprecated method | 84 | 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:104:9 | 104 | buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() | ^^^^^^^^^^ | help: replace the use of the deprecated method | 104 | 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:120:9 | 120 | buf.trim_right().chars().collect() | ^^^^^^^^^^ | help: replace the use of the deprecated method | 120 | buf.trim_end().chars().collect() | ~~~~~~~~
ソースコード
#![allow(unused_imports, unused_macros, unknown_lints)] use std::collections::*; use std::f64::*; use std::cmp::*; use std::cmp::Ordering::*; macro_rules! dump {($($e:expr), +) => {println!(concat!($(stringify!($e), " = {:?}\n"), +), $($e), +)}} macro_rules! max {($e0:expr, $($e:expr), +) => {{let mut r = $e0; $(r = max(r, $e);)+ r}}} macro_rules! min {($e0:expr, $($e:expr), +) => {{let mut r = $e0; $(r = min(r, $e);)+ r}}} macro_rules! freq {($v:expr) => {{let mut h = HashMap::new(); for x in $v {*h.entry(x).or_insert(0) += 1} h}}} fn main() { let (n,d,k) = get::tuple3::<usize,usize,usize>(); let last = d as isize - (1..k).sum::<usize>() as isize; if last < k as isize || n < k {println!("-1"); return} let mut ans = vec![]; for x in 1..k {ans.push(x)} ans.push(last as usize); let mut co = 0; for i in (0..k).rev() { ans[i] += co; if ans[i] <= n - (k-i-1) { break } else { co = ans[i] - (n - (k-i-1)); ans[i] = n - (k-i-1) } } put::vec(&ans, " ") } #[allow(dead_code)] mod get { use std::io::*; use std::str::*; use std::process::*; pub fn val<T: FromStr>() -> T { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} 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(); if buf.is_empty() {println!("No input"); exit(0)} 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(); if buf.is_empty() {println!("No input"); exit(0)} 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 vec<T: FromStr>() -> Vec<T> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() } pub fn mat<T: FromStr>(h: usize) -> Vec<Vec<T>> { let mut mat = vec![]; for _ in 0 .. h { mat.push(vec()); } mat } pub fn chars() -> Vec<char> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} buf.trim_right().chars().collect() } } #[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); } } }