結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー nxteru
提出日時 2018-06-01 23:23:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 217 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 66,504 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 08:58:59
合計ジャッジ時間 2,776 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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