結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-26 17:20:44
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 341 ms / 5,000 ms
コード長 1,010 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 73,988 KB
実行使用メモリ 163,440 KB
最終ジャッジ日時 2024-06-29 13:06:53
合計ジャッジ時間 3,798 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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