結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー face4face4
提出日時 2018-05-19 23:00:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 246 ms / 5,000 ms
コード長 554 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 63,820 KB
実行使用メモリ 144,636 KB
最終ジャッジ日時 2023-09-12 19:26:00
合計ジャッジ時間 3,266 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 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,376 KB
testcase_07 AC 225 ms
144,636 KB
testcase_08 AC 218 ms
122,280 KB
testcase_09 AC 139 ms
94,200 KB
testcase_10 AC 170 ms
106,780 KB
testcase_11 AC 246 ms
129,812 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 213 ms
93,260 KB
testcase_15 AC 218 ms
133,472 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 50 ms
39,392 KB
testcase_18 AC 188 ms
141,284 KB
testcase_19 AC 26 ms
21,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

const int N = (1<<15);
bool dp[5001][N];

int main(){
    for(int i = 0; i < N; i++)  dp[0][i] = false;
    dp[0][0] = true;
    int n;
    cin >> n;
    
    int x;
    for(int j = 1; j <= n; j++){
        cin >> x;
        for(int i = 0; i < N; i++){
            if(dp[j-1][i]){
                dp[j][i] = true;
                dp[j][i^x] = true;
            }
        }
    }

    int count = 0;
    for(int i = 0; i < N; i++){
        if(dp[n][i])    count++;
    }

    cout << count << endl;
    return 0;
}
0