結果
問題 | No.1665 quotient replace |
ユーザー | koba-e964 |
提出日時 | 2021-09-04 10:25:09 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,978 bytes |
コンパイル時間 | 13,079 ms |
コンパイル使用メモリ | 402,356 KB |
実行使用メモリ | 201,508 KB |
最終ジャッジ日時 | 2024-12-17 17:38:05 |
合計ジャッジ時間 | 101,414 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,811 ms
193,588 KB |
testcase_01 | AC | 1,808 ms
193,544 KB |
testcase_02 | AC | 1,772 ms
193,624 KB |
testcase_03 | AC | 1,866 ms
193,584 KB |
testcase_04 | AC | 1,851 ms
193,624 KB |
testcase_05 | AC | 1,809 ms
193,612 KB |
testcase_06 | AC | 1,818 ms
193,632 KB |
testcase_07 | AC | 1,821 ms
193,548 KB |
testcase_08 | AC | 1,821 ms
193,568 KB |
testcase_09 | AC | 1,865 ms
193,768 KB |
testcase_10 | AC | 1,922 ms
196,076 KB |
testcase_11 | AC | 2,006 ms
199,492 KB |
testcase_12 | AC | 1,889 ms
194,292 KB |
testcase_13 | WA | - |
testcase_14 | AC | 1,993 ms
201,352 KB |
testcase_15 | AC | 2,004 ms
201,360 KB |
testcase_16 | AC | 1,967 ms
201,300 KB |
testcase_17 | AC | 1,882 ms
201,356 KB |
testcase_18 | AC | 1,766 ms
193,552 KB |
testcase_19 | AC | 1,836 ms
193,552 KB |
testcase_20 | AC | 1,813 ms
193,472 KB |
testcase_21 | AC | 1,761 ms
193,608 KB |
testcase_22 | AC | 1,771 ms
193,552 KB |
testcase_23 | AC | 1,775 ms
193,644 KB |
testcase_24 | AC | 1,790 ms
193,556 KB |
testcase_25 | AC | 1,821 ms
193,644 KB |
testcase_26 | AC | 1,813 ms
193,588 KB |
testcase_27 | AC | 1,791 ms
193,572 KB |
testcase_28 | AC | 1,797 ms
193,892 KB |
testcase_29 | AC | 1,774 ms
194,072 KB |
testcase_30 | AC | 1,852 ms
197,440 KB |
testcase_31 | AC | 1,887 ms
199,640 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 1,863 ms
198,096 KB |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | AC | 1,776 ms
193,528 KB |
testcase_43 | AC | 1,796 ms
193,600 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 { 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" }); }