結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー ngtkanangtkana
提出日時 2023-04-06 01:15:44
言語 Rust
(1.77.0)
結果
AC  
実行時間 192 ms / 5,000 ms
コード長 632 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 167,272 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 02:37:37
合計ジャッジ時間 2,729 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 171 ms
6,940 KB
testcase_08 AC 171 ms
6,944 KB
testcase_09 AC 117 ms
6,940 KB
testcase_10 AC 142 ms
6,940 KB
testcase_11 AC 185 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 192 ms
6,940 KB
testcase_15 AC 192 ms
6,944 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 43 ms
6,940 KB
testcase_18 AC 166 ms
6,940 KB
testcase_19 AC 22 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{stdin, BufRead};

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock().lines().map(Result::unwrap);
    let _n = stdin.next().unwrap().parse::<usize>().unwrap();
    let a = stdin
        .next()
        .unwrap()
        .split_whitespace()
        .map(|x| x.parse::<usize>().unwrap())
        .collect::<Vec<_>>();
    let mut dp = vec![false; 1 << 15];
    dp[0] = true;
    for &x in &a {
        let mut swp = dp.clone();
        for i in 0..1 << 15 {
            swp[i ^ x] |= dp[i];
        }
        dp = swp;
    }
    let ans = dp.iter().filter(|&&x| x).count();
    println!("{}", ans);
}
0