結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー suakii
提出日時 2019-05-01 11:28:36
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 455 bytes
コンパイル時間 1,676 ms
コンパイル使用メモリ 157,656 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-01 23:19:08
合計ジャッジ時間 2,963 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int MAX = 1 << 15;
int dp[MAX];

int main() {
    ios::sync_with_stdio(false);
    int n, t; cin >> n;
    dp[0] = true;
    for (int i = 0; i < n; i++) {
        cin >> t;
        for (int j = 0; j < MAX; j++)
            if(dp[j])
                dp[t ^ j] = true;
    }
    int ans = 0;
    for (int i = 0; i < MAX; i++)
        if(dp[i])
            ans++;
    cout << ans << endl;

    return 0;
}
0