結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー latte0119latte0119
提出日時 2015-04-27 00:14:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 955 ms / 5,000 ms
コード長 440 bytes
コンパイル時間 1,132 ms
コンパイル使用メモリ 143,764 KB
実行使用メモリ 138,136 KB
最終ジャッジ日時 2023-09-11 11:11:29
合計ジャッジ時間 6,503 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 955 ms
138,136 KB
testcase_08 AC 533 ms
92,560 KB
testcase_09 AC 365 ms
64,380 KB
testcase_10 AC 439 ms
76,928 KB
testcase_11 AC 575 ms
100,284 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 24 ms
23,512 KB
testcase_15 AC 595 ms
103,736 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 132 ms
25,592 KB
testcase_18 AC 756 ms
116,084 KB
testcase_19 AC 65 ms
14,028 KB
権限があれば一括ダウンロードができます

ソースコード

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