結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー Goryudyuma
提出日時 2015-04-21 16:33:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 512 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 59,524 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-04 19:07:29
合計ジャッジ時間 1,731 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;


int main()
{
	bool dp[16385] = {}, dp2[16385] = {};
	int N,a;
	cin >> N;
	dp[0] = 1;
	for (size_t i = 0; i < N; i++)
	{
		cin >> a;
		if (!dp[a])
		{
			for (size_t j = 0; j < 16385; j++)
			{
				if (dp[j])
				{
					dp2[a^j] = 1;
				}
			}
			for (size_t j = 0; j < 16385; j++)
			{
				dp[j] |= dp2[j];
			}
			dp[a] = 1;
		}
	}
	int ans = 0;
	for (size_t i = 0; i < 16385; i++)
	{
		ans += dp[i];
	}
	cout << ans << endl;
}
0