結果

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

bool used[1<<15];
int A[5000];
int N;
bool memo[5000][1<<15];
void dfs(int pos,int val){
    used[val]=true;
    if(pos==N)return;
    if(memo[pos][val])return;
    memo[pos][val]=true;
    dfs(pos+1,val^A[pos]);
    dfs(pos+1,val);
}
int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>A[i];
    dfs(0,0);
    int cnt=0;
    for(int i=0;i<(1<<15);i++)if(used[i])cnt++;
    cout<<cnt<<endl;
}
0