結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー llllll
提出日時 2018-04-08 22:58:18
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 218 ms / 5,000 ms
コード長 798 bytes
コンパイル時間 874 ms
コンパイル使用メモリ 90,360 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 18:03:42
合計ジャッジ時間 3,182 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 217 ms
4,376 KB
testcase_08 AC 194 ms
4,376 KB
testcase_09 AC 133 ms
4,376 KB
testcase_10 AC 160 ms
4,376 KB
testcase_11 AC 211 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 187 ms
4,376 KB
testcase_15 AC 218 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 49 ms
4,380 KB
testcase_18 AC 202 ms
4,376 KB
testcase_19 AC 25 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    const int maxSize = 1 << 15;
    int dp[maxSize] = {};

    cin >> N;
    dp[0] = true;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        dp[a] = true;
        for (int j = 0; j < maxSize; j++) {
            if (dp[j]) {
                dp[a ^ j] = true;
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < maxSize; i++) {
        if (dp[i])
            ans++;
    }
    cout << ans << endl;

    return 0;
}
0