結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kaffelun
提出日時 2018-06-10 13:18:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 588 bytes
コンパイル時間 1,341 ms
コンパイル使用メモリ 158,184 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 13:15:40
合計ジャッジ時間 2,976 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const int A_max = 0x8000;

bool dp[A_max];

int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N;
    cin >> N;
    for(int i = 0; i < A_max; i++) {
        dp[i] = 0;
    }
    dp[0] = 1;
    for(int i = 0; i < N; i++) {
        int a;
        cin >> a;
        for(int x = 0; x < A_max; x++) {
            dp[x] |= dp[x^a];
        }
    }
    int ans = 0;
    for(int i = 0; i < A_max; i++) {
        ans += dp[i];
    }
    cout << ans << endl;
    return 0;
}
0