結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー phsplsphspls
提出日時 2020-06-28 19:08:04
言語 Rust
(1.72.1)
結果
AC  
実行時間 3,857 ms / 5,000 ms
コード長 752 bytes
コンパイル時間 2,521 ms
コンパイル使用メモリ 196,232 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-23 19:39:22
合計ジャッジ時間 30,353 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 3 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 3,738 ms
6,676 KB
testcase_08 AC 3,474 ms
6,676 KB
testcase_09 AC 2,481 ms
6,676 KB
testcase_10 AC 2,927 ms
6,676 KB
testcase_11 AC 3,757 ms
6,676 KB
testcase_12 AC 6 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 0 ms
6,676 KB
testcase_15 AC 3,857 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
testcase_17 AC 950 ms
6,676 KB
testcase_18 AC 3,549 ms
6,676 KB
testcase_19 AC 472 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::collections::HashSet;

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    let a: HashSet<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();

    let mut result: Vec<bool> = vec![false; 2usize.pow(15u32)];
    let mut checked: HashSet<usize> = HashSet::new();
    result[0] = true;
    checked.insert(0);
    for v in a.iter() {
        for i in checked.iter() {
            let val = v ^ i;
            result[val] = true;
        }
        checked = result.iter().enumerate().filter(|pair| *pair.1).map(|pair| pair.0).collect();
    }
    println!("{}", result.iter().filter(|&&flg| flg).count());
}
0