結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー mencotton
提出日時 2020-02-14 18:35:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 638 ms / 5,000 ms
コード長 444 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 68,736 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 23:46:51
合計ジャッジ時間 5,853 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;

    vector<bool> dp(40000);
    dp[0] = true;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        for (int j = 0; j < 40000; j++) {
            if (dp[j])dp[j ^ a] = true;
        }
    }

    int count = 0;
    for (int i = 0; i < 40000; i++) {
        if (dp[i])count++;
    }
    cout << count << endl;
    return 0;
}
0