結果

問題 No.183 たのしい排他的論理和(EASY)
コンテスト
ユーザー d_nishiyama85
提出日時 2016-07-09 20:59:10
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 178 ms / 5,000 ms
+ 256µs
コード長 739 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 306 ms
コンパイル使用メモリ 77,600 KB
実行使用メモリ 9,792 KB
最終ジャッジ日時 2026-10-12 14:39:57
合計ジャッジ時間 3,285 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <vector>
#include <iostream>

using namespace std;
#define MAX (1<<15)


bool now[MAX];
bool nex[MAX];
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    int ans = 0;

    now[0] = true;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < MAX; j++)
        {
            if (now[j]) {
              int num = j ^ A[i];
              nex[num] = true;
            }
            nex[j] |= now[j];
        }

        for (int j = 0; j < MAX; j++)
        {
            now[j] |= nex[j];
        }
    }

    for (int i = 0; i < MAX; i++)
    {
        if (now[i]) ans++;
    }


    cout << ans << endl;
    //cout << (1ll << ans) << endl;
}
0