結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー nxterunxteru
提出日時 2018-06-01 23:23:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 188 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 65,764 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 21:28:27
合計ジャッジ時間 2,838 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 164 ms
4,376 KB
testcase_08 AC 168 ms
4,380 KB
testcase_09 AC 115 ms
4,380 KB
testcase_10 AC 139 ms
4,376 KB
testcase_11 AC 182 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 188 ms
4,380 KB
testcase_15 AC 186 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 42 ms
4,376 KB
testcase_18 AC 161 ms
4,380 KB
testcase_19 AC 22 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
bool dp[2][1<<15];
int n,ans;
int main(void){
    dp[0][0]=true;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int a,u=(i+1)%2;
        scanf("%d",&a);
        for(int j=0;j<1<<15;j++){
            if(dp[i%2][j]){
                dp[u][j]=true;
                dp[u][j^a]=true;
            }
        }
    }
    for(int i=0;i<1<<15;i++)if(dp[n%2][i])ans++;
    printf("%d\n",ans);
}
0