結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー RubikunRubikun
提出日時 2019-06-17 03:42:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,741 ms / 5,000 ms
コード長 672 bytes
コンパイル時間 1,443 ms
コンパイル使用メモリ 166,528 KB
実行使用メモリ 163,700 KB
最終ジャッジ日時 2023-09-14 21:08:38
合計ジャッジ時間 19,501 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,380 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 2 ms
4,376 KB
testcase_07 AC 2,741 ms
145,292 KB
testcase_08 AC 2,252 ms
145,772 KB
testcase_09 AC 1,103 ms
100,848 KB
testcase_10 AC 1,570 ms
120,948 KB
testcase_11 AC 2,382 ms
157,876 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1,741 ms
163,700 KB
testcase_15 AC 2,471 ms
163,532 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 222 ms
38,748 KB
testcase_18 AC 2,388 ms
141,912 KB
testcase_19 AC 114 ms
20,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007;

int main(){

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