結果
問題 | No.1665 quotient replace |
ユーザー | koba-e964 |
提出日時 | 2021-09-04 10:27:59 |
言語 | Rust (1.77.0) |
結果 |
AC
|
実行時間 | 1,908 ms / 3,000 ms |
コード長 | 1,982 bytes |
コンパイル時間 | 3,130 ms |
コンパイル使用メモリ | 153,192 KB |
実行使用メモリ | 204,252 KB |
最終ジャッジ日時 | 2023-08-22 17:21:53 |
合計ジャッジ時間 | 82,026 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,651 ms
196,272 KB |
testcase_01 | AC | 1,664 ms
196,252 KB |
testcase_02 | AC | 1,650 ms
196,276 KB |
testcase_03 | AC | 1,639 ms
196,268 KB |
testcase_04 | AC | 1,683 ms
196,224 KB |
testcase_05 | AC | 1,658 ms
196,472 KB |
testcase_06 | AC | 1,649 ms
196,400 KB |
testcase_07 | AC | 1,630 ms
196,284 KB |
testcase_08 | AC | 1,662 ms
196,272 KB |
testcase_09 | AC | 1,677 ms
196,524 KB |
testcase_10 | AC | 1,716 ms
198,828 KB |
testcase_11 | AC | 1,758 ms
202,400 KB |
testcase_12 | AC | 1,660 ms
197,048 KB |
testcase_13 | AC | 1,815 ms
204,248 KB |
testcase_14 | AC | 1,802 ms
204,240 KB |
testcase_15 | AC | 1,908 ms
204,236 KB |
testcase_16 | AC | 1,803 ms
204,204 KB |
testcase_17 | AC | 1,789 ms
204,252 KB |
testcase_18 | AC | 1,640 ms
196,256 KB |
testcase_19 | AC | 1,672 ms
196,200 KB |
testcase_20 | AC | 1,658 ms
196,464 KB |
testcase_21 | AC | 1,647 ms
196,252 KB |
testcase_22 | AC | 1,657 ms
196,292 KB |
testcase_23 | AC | 1,624 ms
196,448 KB |
testcase_24 | AC | 1,684 ms
196,400 KB |
testcase_25 | AC | 1,644 ms
196,252 KB |
testcase_26 | AC | 1,623 ms
196,284 KB |
testcase_27 | AC | 1,661 ms
196,488 KB |
testcase_28 | AC | 1,657 ms
196,536 KB |
testcase_29 | AC | 1,871 ms
196,812 KB |
testcase_30 | AC | 1,724 ms
200,396 KB |
testcase_31 | AC | 1,783 ms
202,480 KB |
testcase_32 | AC | 1,750 ms
201,936 KB |
testcase_33 | AC | 1,721 ms
198,384 KB |
testcase_34 | AC | 1,743 ms
200,880 KB |
testcase_35 | AC | 1,706 ms
200,592 KB |
testcase_36 | AC | 1,714 ms
200,688 KB |
testcase_37 | AC | 1,730 ms
200,288 KB |
testcase_38 | AC | 1,761 ms
201,152 KB |
testcase_39 | AC | 1,717 ms
199,608 KB |
testcase_40 | AC | 1,703 ms
199,620 KB |
testcase_41 | AC | 1,736 ms
199,628 KB |
testcase_42 | AC | 1,687 ms
196,296 KB |
testcase_43 | AC | 1,669 ms
196,456 KB |
ソースコード
#[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; // https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 macro_rules! input { ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; } macro_rules! input_inner { ($next:expr) => {}; ($next:expr,) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; } macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ($(read_value!($next, $t)),*) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error")); } trait Change { fn chmax(&mut self, x: Self); fn chmin(&mut self, x: Self); } impl<T: PartialOrd> Change for T { fn chmax(&mut self, x: T) { if *self < x { *self = x; } } fn chmin(&mut self, x: T) { if *self > x { *self = x; } } } fn main() { input! { n: usize, a: [usize; n], } const W: usize = 1_000_001; let mut fac = vec![vec![]; W]; for i in 1..W { for j in 2..(W - 1) / i + 1 { fac[i * j].push(i); } } let mut g = vec![0; W]; for i in 2..W { let mut seen = 0; for &w in &fac[i] { seen |= 1 << g[w]; } let mut mex = 0; while (seen & 1 << mex) != 0 { mex += 1; } g[i] = mex; } let mut ans = 0; for a in a { ans ^= g[a]; } println!("{}", if ans == 0 { "black" } else { "white" }); }