結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー Ronlynes
提出日時 2017-08-22 15:45:48
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 209 ms / 5,000 ms
コード長 532 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 54,872 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 02:59:15
合計ジャッジ時間 2,819 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(void){
    int n, a[5004];
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    bool dp[50000];
    fill(dp, dp+50000, false);
    dp[0] = true;
    for(int i=0; i<n; i++){
        for(int j=0; j<50000; j++){
            if(!dp[j]){
                continue;
            }
            dp[j^a[i]] = true;
        }
    }
    int cnt=0;
    for(int i=0; i<50000; i++){
        if(dp[i]){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}
0