結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-26 17:20:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 322 ms / 5,000 ms
コード長 1,010 bytes
コンパイル時間 3,499 ms
コンパイル使用メモリ 73,404 KB
実行使用メモリ 163,520 KB
最終ジャッジ日時 2023-09-11 23:47:47
合計ジャッジ時間 4,292 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 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 3 ms
4,376 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 296 ms
146,912 KB
testcase_08 AC 286 ms
146,656 KB
testcase_09 AC 195 ms
101,612 KB
testcase_10 AC 237 ms
122,096 KB
testcase_11 AC 312 ms
158,968 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 317 ms
163,416 KB
testcase_15 AC 322 ms
163,520 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 72 ms
40,144 KB
testcase_18 AC 278 ms
142,680 KB
testcase_19 AC 36 ms
21,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <string>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

#define PI 3.1415926535

typedef long long ll;
typedef pair<int, int> P;
//typedef complex<double> C;

const int MAX_N = 5000;
const int MAX = 1<<15;

int N;
int A[MAX_N];
bool dp[MAX_N + 1][MAX];

void input() {
	cin >> N;
	REP(i, N) cin >> A[i];
}

void solve() {
	REP(i, N) {
		REP(j, MAX) {
			dp[i][j] = false;
		}
	}
	dp[0][0] = true;

	REP(i, N) {
		REP(j, MAX) {
			dp[i+1][j ^ A[i]] |= dp[i][j];
			dp[i+1][j] |= dp[i][j];
		}
	}
	int cnt = 0;
	REP(j, MAX) {
		if (dp[N][j]) {
			cnt++;
		}
	}
	cout << cnt << endl;
}

int main() {
	input();
	solve();
}
0