結果
問題 | No.5018 Let's Make a Best-seller Book |
ユーザー |
![]() |
提出日時 | 2023-10-01 13:36:46 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 32 ms / 400 ms |
コード長 | 1,592 bytes |
コンパイル時間 | 1,282 ms |
コンパイル使用メモリ | 155,132 KB |
実行使用メモリ | 24,384 KB |
スコア | 2,487 |
平均クエリ数 | 52.00 |
最終ジャッジ日時 | 2023-10-01 13:36:55 |
合計ジャッジ時間 | 9,018 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
コンパイルメッセージ
warning: unused variable: `M_current` --> Main.rs:40:17 | 40 | let M_current = input!(usize); | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_M_current` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `S` --> Main.rs:41:17 | 41 | let S = input!(usize, N); | ^ help: if this is intentional, prefix it with an underscore: `_S` warning: unused variable: `P` --> Main.rs:42:17 | 42 | let P = input!(isize, N); | ^ help: if this is intentional, prefix it with an underscore: `_P` warning: unused variable: `R` --> Main.rs:43:17 | 43 | let R = input!(usize, N); | ^ help: if this is intentional, prefix it with an underscore: `_R` warning: 4 warnings emitted
ソースコード
#![allow(unused_must_use, non_snake_case)] use std::io::{stdin, stdout, BufWriter, Write}; fn main() { let mut scan = Scanner::default(); macro_rules! input { ($T: ty) => { scan.next::<$T>() }; ($T: ty, $N: expr) => { (0..$N).map(|_| scan.next::<$T>()).collect::<Vec<_>>() }; } let T = input!(usize); let N = input!(usize); let M = input!(usize); // とりあえず一日に使えるお金を均等にしてみる let C = M / (500 * T); for _ in 0..T { // output { let out = &mut BufWriter::new(stdout()); writeln!( out, "1 {}", vec![C / N; N] .iter() .map(|x| x.to_string()) .collect::<Vec<_>>() .join(" ") ); } // input { let M_current = input!(usize); let S = input!(usize, N); let P = input!(isize, N); let R = input!(usize, N); } } } #[derive(Default)] struct Scanner { buffer: Vec<String>, } impl Scanner { fn next<T: std::str::FromStr>(&mut self) -> T { loop { if let Some(token) = self.buffer.pop() { return token.parse().ok().expect("Failed parse"); } let mut input = String::new(); stdin().read_line(&mut input).expect("Failed read"); self.buffer = input.split_whitespace().rev().map(String::from).collect(); } } }