結果

問題 No.1665 quotient replace
ユーザー koba-e964koba-e964
提出日時 2021-09-04 10:25:09
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,978 bytes
コンパイル時間 15,747 ms
コンパイル使用メモリ 380,544 KB
実行使用メモリ 201,472 KB
最終ジャッジ日時 2024-05-09 23:02:16
合計ジャッジ時間 103,470 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,866 ms
193,488 KB
testcase_01 AC 1,863 ms
193,560 KB
testcase_02 AC 1,863 ms
193,652 KB
testcase_03 AC 1,864 ms
193,484 KB
testcase_04 AC 1,861 ms
193,408 KB
testcase_05 AC 1,853 ms
193,536 KB
testcase_06 AC 1,837 ms
193,664 KB
testcase_07 AC 1,829 ms
193,536 KB
testcase_08 AC 1,812 ms
193,648 KB
testcase_09 AC 1,837 ms
193,784 KB
testcase_10 AC 1,816 ms
196,224 KB
testcase_11 AC 1,892 ms
199,520 KB
testcase_12 AC 1,855 ms
194,176 KB
testcase_13 WA -
testcase_14 AC 1,880 ms
201,472 KB
testcase_15 AC 1,879 ms
201,356 KB
testcase_16 AC 1,922 ms
201,360 KB
testcase_17 AC 1,880 ms
201,344 KB
testcase_18 AC 1,826 ms
193,624 KB
testcase_19 AC 1,843 ms
193,636 KB
testcase_20 AC 1,814 ms
193,656 KB
testcase_21 AC 1,768 ms
193,536 KB
testcase_22 AC 1,802 ms
193,628 KB
testcase_23 AC 1,834 ms
193,420 KB
testcase_24 AC 1,792 ms
193,664 KB
testcase_25 AC 1,800 ms
193,776 KB
testcase_26 AC 1,849 ms
193,408 KB
testcase_27 AC 1,795 ms
193,664 KB
testcase_28 AC 1,828 ms
193,696 KB
testcase_29 AC 1,794 ms
194,076 KB
testcase_30 AC 1,925 ms
197,504 KB
testcase_31 AC 1,901 ms
199,576 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 2,075 ms
198,100 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,814 ms
193,572 KB
testcase_43 AC 1,807 ms
193,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#[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" });
}
0