結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー Khiromu
提出日時 2017-03-21 14:01:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 419 ms / 5,000 ms
コード長 453 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 72,756 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 00:49:06
合計ジャッジ時間 3,802 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define MAX (1<<15)

int main()
{
	int N;
	vector<int> A;
	cin >> N;
	REP(i, 0, N) {
		int a;
		cin >> a;
		A.push_back(a);
	}

	vector<bool> dp(MAX + 1, false);
	dp[0] = true;
	REP(i, 0, N) {
		REP(j, 0, MAX) {
			if (dp[j]) dp[j^A[i]] = true;
		}
	}

	int count = 0;
	REP(j, 0, MAX) {
		if (dp[j]) count++;
	}

	cout << count << endl;
    return 0;
}
0