結果
問題 | No.1619 Coccinellidae |
ユーザー | ikd |
提出日時 | 2021-07-22 22:45:30 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,482 bytes |
コンパイル時間 | 12,907 ms |
コンパイル使用メモリ | 387,080 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-17 19:08:02 |
合計ジャッジ時間 | 13,980 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
6,816 KB |
testcase_01 | AC | 91 ms
6,812 KB |
testcase_02 | WA | - |
testcase_03 | AC | 0 ms
6,940 KB |
testcase_04 | AC | 110 ms
6,940 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 69 ms
6,940 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 56 ms
6,944 KB |
testcase_11 | WA | - |
testcase_12 | AC | 1 ms
6,940 KB |
testcase_13 | AC | 111 ms
6,940 KB |
testcase_14 | WA | - |
testcase_15 | AC | 1 ms
6,940 KB |
testcase_16 | AC | 1 ms
6,944 KB |
ソースコード
//! # Bundled libraries //! //! - `procon_reader 0.1.0 (git+https://github.com/ia7ck/rust-competitive-programming#ed937ca54c1c4220ab9bc2901a6189b8d58a80a4)` licensed under **missing** as `crate::__cargo_equip::crates::procon_reader` pub use __cargo_equip::prelude::*; use procon_reader::ProconReader; fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let n: usize = rd.get(); let m: usize = rd.get(); let k: usize = rd.get(); let mut tail = Vec::new(); let mut inv = 0; let mut a = Vec::new(); for x in (0..n).rev() { if inv + x.saturating_sub(tail.len()) <= k { inv += x.saturating_sub(tail.len()); a.push(x); } else { tail.push(x); } } tail.reverse(); a.extend(tail); let s = a.iter().copied().sum::<usize>(); assert!(s <= m); let i = a.iter().position(|&x| x == n - 1).unwrap(); a[i] += m - s; for x in a { println!("{}", x); } } // The following code was expanded by `cargo-equip`. #[rustfmt::skip] #[allow(unused)] mod __cargo_equip { pub(crate) mod crates { pub mod procon_reader {use std::io::BufRead;use std::str::FromStr;pub struct ProconReader<R>{r:R,l:String,i:usize,}impl<R:BufRead>ProconReader<R>{pub fn new(reader:R)->Self{Self{r:reader,l:String::new(),i:0,}}pub fn get<T>(&mut self)->T where T:FromStr,<T as FromStr>::Err:std::fmt::Debug,{self.skip_blanks();assert!(self.i<self.l.len());assert_ne!(&self.l[self.i..=self.i]," ");let rest=&self.l[self.i..];let len=rest.find(' ').unwrap_or_else(| |rest.len());let val=rest[..len].parse().unwrap_or_else(|e|panic!("{:?}, attempt to read `{}`",e,rest));self.i+=len;val}fn skip_blanks(&mut self){loop{match self.l[self.i..].find(|ch|ch!=' '){Some(j)=>{self.i+=j;break;}None=>{let mut buf=String::new();let num_bytes=self.r.read_line(&mut buf).unwrap_or_else(|_|panic!("invalid UTF-8"));assert!(num_bytes>0,"reached EOF :(");self.l=buf.trim_end_matches('\n').trim_end_matches('\r').to_string();self.i=0;}}}}pub fn get_vec<T>(&mut self,n:usize)->Vec<T>where T:FromStr,<T as FromStr>::Err:std::fmt::Debug,{(0..n).map(|_|self.get()).collect()}pub fn get_chars(&mut self)->Vec<char>{self.get::<String>().chars().collect()}}} } pub(crate) mod macros { pub mod procon_reader {} } pub(crate) mod prelude {pub use crate::__cargo_equip::crates::*;} mod preludes { pub mod procon_reader {} } }