結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー lll
提出日時 2018-04-08 22:58:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 186 ms / 5,000 ms
コード長 798 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 92,180 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 05:46:30
合計ジャッジ時間 2,686 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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