結果

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

ソースコード

diff #

#include <iostream>
using namespace std;

int main(void)
{
    const int maxdp = 16384 * 2;
    int n;
    int a[5000];
    bool dp[16384 * 2] = {0};
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    dp[0] = true;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < maxdp; j++)
            if(dp[j])
                dp[a[i] ^ j] = true;
    int count = 0;
    for(int i = 0; i < maxdp; i++)
        if(dp[i])
            count++;
    cout << count << endl;
    return 0;
}
0