結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー OUDONOUDON
提出日時 2017-09-29 11:43:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 203 ms / 5,000 ms
コード長 1,169 bytes
コンパイル時間 1,480 ms
コンパイル使用メモリ 163,972 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 15:14:51
合計ジャッジ時間 3,977 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 193 ms
4,376 KB
testcase_08 AC 181 ms
4,376 KB
testcase_09 AC 124 ms
4,380 KB
testcase_10 AC 149 ms
4,380 KB
testcase_11 AC 195 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 158 ms
4,376 KB
testcase_15 AC 203 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 46 ms
4,380 KB
testcase_18 AC 182 ms
4,380 KB
testcase_19 AC 23 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<14> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

const int MAX_X = 1<<15;
bool dp[2][MAX_X];

int main()
{
    ios::sync_with_stdio(false);
    int N; cin >> N;

    dp[0][0] = true;
    rep(i, N) {
#ifdef DEUBUG
        DUMP(i)
#endif
        int A; cin >> A;
        for (int j=0; j<MAX_X; j++) {
            dp[(i+1)&1][j] |= dp[i&1][j];
            if (dp[i&1][j]) {
                dp[(i+1)&1][A^j] = true;
            }
        }
    }

    ll ans = 0;
    rep(i, MAX_X) {
        if (dp[N&1][i]) ans++;
#ifdef DEBUG
        if (i < 1<<4) cerr << i << " " << dp[N&1][i] << endl;
#endif
    }
    cout << ans << endl;
}
0