結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー h_noson
提出日時 2016-02-16 19:32:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 225 ms / 5,000 ms
コード長 483 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 59,612 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 12:55:06
合計ジャッジ時間 2,644 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

int main() {
    int n;
    cin >> n;
    bool dp[32768];

    fill(dp,dp+32768,false);
    dp[0] = true;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        for (int j = 0; j < 32768; j++) {
            if (dp[j])
                dp[j^a] = true;
        }
    }
    int ans = 0;
    for (int i = 0; i < 32768; i++) {
        if (dp[i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}
0