結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー KKT89KKT89
提出日時 2020-07-14 11:54:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 186 ms / 5,000 ms
コード長 736 bytes
コンパイル時間 1,073 ms
コンパイル使用メモリ 110,376 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-10 19:39:02
合計ジャッジ時間 3,676 ms
ジャッジサーバーID
(参考情報)
judge14 / 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,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 155 ms
4,380 KB
testcase_08 AC 165 ms
4,376 KB
testcase_09 AC 113 ms
4,376 KB
testcase_10 AC 137 ms
4,376 KB
testcase_11 AC 181 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 178 ms
4,380 KB
testcase_15 AC 186 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 40 ms
4,380 KB
testcase_18 AC 155 ms
4,376 KB
testcase_19 AC 22 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
using ull = unsigned long long;

bool dp[1<<15];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    dp[0]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<(1<<15);j++){
            if(dp[j]){
                dp[j^a[i]]=1;
            }
        }
    }
    int res=0;
    for(int j=0;j<(1<<15);j++){
        if(dp[j])res++;
    }
    printf("%d\n",res);
}
0