結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー Naco
提出日時 2019-07-06 20:24:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 219 ms / 5,000 ms
コード長 427 bytes
コンパイル時間 737 ms
コンパイル使用メモリ 59,196 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-01 08:44:52
合計ジャッジ時間 2,789 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N;
    cin >> N;
    int A[N];
    for(int i=0;i<N;i++) cin >> A[i];
    int MAX=1<<15;
    bool dp[MAX]={};
    dp[0]=true;
    for(int i=0;i<N;i++){
        for(int j=0;j<MAX;j++){
            if(dp[j]==true) dp[j^A[i]]=true;
        }
    }
    int cnt=0;
    for(int i=0;i<MAX;i++){
        if(dp[i]==true) cnt++;
    }
    cout << cnt << endl;
}
0