結果

問題 No.2672 Subset Xor Sum
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2024-03-15 23:01:49
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 2,938 bytes
コンパイル時間 1,319 ms
コンパイル使用メモリ 192,052 KB
実行使用メモリ 32,628 KB
最終ジャッジ日時 2024-03-15 23:01:54
合計ジャッジ時間 4,214 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 4 ms
6,548 KB
testcase_03 AC 4 ms
6,548 KB
testcase_04 AC 3 ms
6,548 KB
testcase_05 AC 4 ms
6,548 KB
testcase_06 AC 4 ms
6,548 KB
testcase_07 AC 4 ms
6,548 KB
testcase_08 AC 4 ms
6,548 KB
testcase_09 AC 4 ms
6,548 KB
testcase_10 AC 3 ms
6,548 KB
testcase_11 AC 4 ms
6,548 KB
testcase_12 AC 4 ms
6,548 KB
testcase_13 AC 4 ms
6,548 KB
testcase_14 AC 3 ms
6,548 KB
testcase_15 AC 4 ms
6,548 KB
testcase_16 AC 4 ms
6,548 KB
testcase_17 AC 4 ms
6,548 KB
testcase_18 AC 4 ms
6,548 KB
testcase_19 AC 4 ms
6,548 KB
testcase_20 AC 4 ms
6,548 KB
testcase_21 AC 4 ms
6,548 KB
testcase_22 AC 4 ms
6,548 KB
testcase_23 AC 4 ms
6,548 KB
testcase_24 AC 3 ms
6,548 KB
testcase_25 AC 1 ms
6,548 KB
testcase_26 AC 1 ms
6,548 KB
testcase_27 AC 3 ms
6,548 KB
testcase_28 AC 4 ms
6,548 KB
testcase_29 AC 4 ms
6,548 KB
testcase_30 AC 58 ms
29,772 KB
testcase_31 AC 23 ms
12,880 KB
testcase_32 AC 20 ms
11,156 KB
testcase_33 AC 40 ms
21,552 KB
testcase_34 AC 53 ms
30,872 KB
testcase_35 AC 45 ms
25,928 KB
testcase_36 AC 52 ms
28,076 KB
testcase_37 AC 27 ms
14,844 KB
testcase_38 AC 63 ms
32,064 KB
testcase_39 AC 11 ms
6,836 KB
testcase_40 AC 34 ms
18,956 KB
testcase_41 AC 50 ms
28,036 KB
testcase_42 AC 42 ms
22,492 KB
testcase_43 AC 62 ms
32,628 KB
testcase_44 AC 39 ms
21,088 KB
testcase_45 AC 1 ms
6,548 KB
testcase_46 AC 2 ms
6,548 KB
testcase_47 AC 2 ms
6,548 KB
testcase_48 AC 1 ms
6,548 KB
testcase_49 AC 2 ms
6,548 KB
testcase_50 AC 2 ms
6,548 KB
testcase_51 AC 2 ms
6,548 KB
testcase_52 AC 2 ms
6,548 KB
testcase_53 AC 2 ms
6,548 KB
testcase_54 AC 2 ms
6,548 KB
testcase_55 AC 1 ms
6,548 KB
testcase_56 AC 2 ms
6,548 KB
testcase_57 AC 1 ms
6,548 KB
testcase_58 AC 1 ms
6,548 KB
testcase_59 AC 2 ms
6,548 KB
testcase_60 AC 1 ms
6,548 KB
testcase_61 AC 3 ms
6,548 KB
testcase_62 AC 1 ms
6,548 KB
testcase_63 AC 1 ms
6,548 KB
testcase_64 AC 1 ms
6,548 KB
testcase_65 WA -
testcase_66 AC 1 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut sc = Scanner::new();
    let n = sc.usize();
    let mut a = sc.vec::<usize>(n);

    let xor = a.iter().fold(0, |acc, &x| acc ^ x);
    if xor != 0 { println!("No"); return; }

    if a.iter().filter(|&&x| x == 0).count() > 0 { println!("Yes"); return; }
    a.sort(); a.dedup();
    if n != a.len() { println!("Yes"); return; }

    let mut ok = vec![vec![false; 200000]; 2];
    ok[1][0] = true;

    for &a in a.iter() {
        if ok[0][a] { println!("Yes"); return; }
        let mut next = vec![vec![false; 200000]; 2];
        for i in 0..=16500 {
            next[0][i] |= ok[1][i] || ok[0][i];
            next[0][a ^ i] |= ok[0][i];
            next[1][a ^ i] |= ok[1][i];
        }
        ok = next;
    }

    println!("No");
}


struct Scanner { s : std::collections::VecDeque<String> } #[allow(unused)] impl Scanner { fn new() -> Self { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); Self { s : s.split_whitespace().map(|s| s.to_string()).collect() } } fn reload(&mut self) -> () { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); self.s = s.split_whitespace().map(|s| s.to_string()).collect(); } fn usize(&mut self) -> usize { self.input() } fn usize1(&mut self) -> usize { self.input::<usize>() - 1 } fn isize(&mut self) -> isize { self.input() } fn i32(&mut self) -> i32 { self.input() } fn i64(&mut self) -> i64 { self.input() } fn i128(&mut self) -> i128 { self.input() } fn u8(&mut self) -> u8 { self.input() } fn u32(&mut self) -> u32 { self.input() } fn u64(&mut self) -> u64 { self.input() } fn u128(&mut self) -> u128 { self.input() } fn edge(&mut self) -> (usize, usize) { (self.usize1(), self.usize1()) } fn edges(&mut self, m : usize) -> Vec<(usize, usize)> { let mut e = Vec::with_capacity(m); for _ in 0..m { e.push(self.edge()); } e } fn wedge<T:std::str::FromStr>(&mut self) -> (usize, usize, T) { (self.usize1(), self.usize1(), self.input()) } fn wedges<T:std::str::FromStr>(&mut self, m : usize) -> Vec<(usize, usize, T)> { let mut e = Vec::with_capacity(m); for _ in 0..m { e.push(self.wedge()); } e } fn input<T>(&mut self) -> T where T: std::str::FromStr { if self.s.is_empty() { self.reload(); } if let Some(head) = self.s.pop_front() { head.parse::<T>().ok().unwrap() } else { panic!() } } fn tuple<T, U>(&mut self) -> (T, U) where T: std::str::FromStr, U: std::str::FromStr { (self.input(), self.input()) } fn vec<T>(&mut self, n: usize) -> Vec<T> where T: std::str::FromStr { if self.s.is_empty() { self.reload(); } self.s.drain(..n).map(|s| s.parse::<T>().ok().unwrap() ).collect::<Vec<T>>() } fn nvec<T>(&mut self) -> Vec<T> where T: std::str::FromStr { let n : usize = self.input(); self.vec(n) } fn chars(&mut self) -> Vec<char> { let s : String = self.input(); s.chars().collect() } fn bytes(&mut self) -> Vec<u8> { let s : String = self.input(); s.bytes().collect() } }
0