結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー RubikunRubikun
提出日時 2020-06-27 16:29:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 271 ms / 5,000 ms
コード長 566 bytes
コンパイル時間 1,549 ms
コンパイル使用メモリ 166,032 KB
実行使用メモリ 162,432 KB
最終ジャッジ日時 2023-09-19 04:55:53
合計ジャッジ時間 5,143 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 271 ms
144,400 KB
testcase_08 AC 234 ms
137,724 KB
testcase_09 AC 160 ms
101,112 KB
testcase_10 AC 191 ms
121,348 KB
testcase_11 AC 247 ms
158,224 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 219 ms
161,360 KB
testcase_15 AC 256 ms
162,432 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 59 ms
39,356 KB
testcase_18 AC 239 ms
141,796 KB
testcase_19 AC 30 ms
21,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

bool dp[5003][1<<15];

int main(){

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