結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー osa_k
提出日時 2015-07-27 01:06:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 328 ms / 5,000 ms
コード長 653 bytes
コンパイル時間 898 ms
コンパイル使用メモリ 55,892 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-06-29 02:33:43
合計ジャッジ時間 3,844 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

//Name: 
//Level: 
//Category: 
//Note: 

/**
 *
 */
#include <iostream>
#include <bitset>

using namespace std;

bool solve(bool first) {
    int N;
    if(!(cin >> N)) return false;

    bitset<1<<15> table;
    table[0] = 1;
    for(int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        for(int j = 0; j < (1<<15); ++j) {
            if(table[j]) table[a^j] = 1;
        }
    }
    cout << table.count() << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) {
        first = false;
    }
    return 0;
}
0