結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー nenuonnenuon
提出日時 2017-06-20 20:35:02
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 363 ms / 5,000 ms
コード長 870 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 82,836 KB
実行使用メモリ 247,800 KB
最終ジャッジ日時 2023-09-12 13:06:48
合計ジャッジ時間 4,524 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 346 ms
219,824 KB
testcase_08 AC 325 ms
220,772 KB
testcase_09 AC 221 ms
152,092 KB
testcase_10 AC 266 ms
182,648 KB
testcase_11 AC 353 ms
239,116 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 347 ms
247,560 KB
testcase_15 AC 363 ms
247,800 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 82 ms
57,220 KB
testcase_18 AC 323 ms
214,608 KB
testcase_19 AC 42 ms
29,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;



int main(){
    int n;
    cin >> n;
    int A[n];
    for(int i = 0; i < n; ++i){
        cin >> A[i];
    }
    bool dp[n+1][50000];
    for(int i = 0; i < n+1; ++i){
        for(int j = 0; j < 50000; ++j){
            dp[i][j] = false;
        }
    }
    dp[0][0] = true;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < 50000; ++j){
            if(!dp[i][j]) continue;
            dp[i+1][j] = true;
            dp[i+1][j^A[i]] = true;
        }
    }
    int cnt = 0;
    for(int j = 0; j < 50000; ++j){
        if(dp[n][j]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}
0