結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー ama_nuko
提出日時 2018-06-11 02:57:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 421 ms / 5,000 ms
コード長 771 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 97,432 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 13:27:26
合計ジャッジ時間 4,799 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    int n;
    cin >> n;

    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<bool> dp(1 << 15);
    dp[0] = true;
    rep(j, n){
        for(int i = 1; i < (1 << 15); i++){
            if(dp[i^a[j]]){
                dp[i] = true;
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < (1 << 15); i++){
        if(dp[i]){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}
0