結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー otamay6otamay6
提出日時 2019-11-18 10:33:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 833 ms / 5,000 ms
コード長 542 bytes
コンパイル時間 1,505 ms
コンパイル使用メモリ 171,820 KB
実行使用メモリ 23,448 KB
最終ジャッジ日時 2023-09-15 15:24:36
合計ジャッジ時間 7,136 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 4 ms
4,384 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 422 ms
21,004 KB
testcase_08 AC 567 ms
20,992 KB
testcase_09 AC 391 ms
15,508 KB
testcase_10 AC 470 ms
17,772 KB
testcase_11 AC 620 ms
22,568 KB
testcase_12 AC 4 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 833 ms
23,448 KB
testcase_15 AC 639 ms
23,384 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 143 ms
7,428 KB
testcase_18 AC 471 ms
20,408 KB
testcase_19 AC 71 ms
5,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    int N;cin>>N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    vector<vector<bool>> dp(N+1,vector<bool>((1<<15),false));
    dp[0][0]=true;
    REP(i,N) REP(j,(1<<15)){
        dp[i+1][j] = dp[i][j]||dp[i][j^A[i]];
    }
    int ans=0;
    REP(i,1<<15) if(dp[N][i]){
        ans++;
    }
    cout<<ans<<endl;
}
0