結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー けーむけーむ
提出日時 2020-07-08 16:31:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 522 ms / 5,000 ms
コード長 1,180 bytes
コンパイル時間 1,736 ms
コンパイル使用メモリ 169,952 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 23:08:15
合計ジャッジ時間 5,513 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 522 ms
6,944 KB
testcase_08 AC 361 ms
6,944 KB
testcase_09 AC 244 ms
6,940 KB
testcase_10 AC 297 ms
6,940 KB
testcase_11 AC 390 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 219 ms
6,940 KB
testcase_15 AC 404 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 91 ms
6,940 KB
testcase_18 AC 431 ms
6,940 KB
testcase_19 AC 44 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll mv = 32768;
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<vector<bool>> dp(2, vector<bool>(mv + 1, false));
    dp[0][0] = true;
    rep(i, n) {
        fill(all(dp[(i + 1) % 2]), false);
        rep(j, mv + 1) {
            if (!dp[i % 2][j]) continue;
            dp[(i + 1) % 2][j] = true;
            ll v = j ^ a[i];
            if (v > mv) continue;
            dp[(i + 1) % 2][v] = true;
        }
    }
    ll ans = 0;
    rep(i, mv + 1) {
        if (dp[n % 2][i]) ans++;
    }
    cout << ans << endl;
    return 0;
}
0