結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー nenuon
提出日時 2017-06-20 20:38:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 316 ms / 5,000 ms
コード長 790 bytes
コンパイル時間 739 ms
コンパイル使用メモリ 90,320 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 01:26:53
合計ジャッジ時間 3,827 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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[50000];
    for(int j = 0; j < 50000; ++j){
        dp[j] = false;
    }
    dp[0] = true;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < 50000; ++j){
            if(!dp[j]) continue;
            dp[j] = true;
            dp[j^A[i]] = true;
        }
    }
    int cnt = 0;
    for(int j = 0; j < 50000; ++j){
        if(dp[j]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}
0