結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-26 17:15:52
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,056 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 74,020 KB
実行使用メモリ 83,468 KB
最終ジャッジ日時 2024-09-22 13:58:24
合計ジャッジ時間 2,250 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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_A = 1<<15 - 1;

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

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

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

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

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