結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー snrnsidysnrnsidy
提出日時 2021-05-27 02:03:25
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 276 ms / 5,000 ms
コード長 585 bytes
コンパイル時間 2,592 ms
コンパイル使用メモリ 209,748 KB
実行使用メモリ 163,544 KB
最終ジャッジ日時 2023-08-05 22:38:52
合計ジャッジ時間 6,094 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
163,356 KB
testcase_01 AC 43 ms
163,352 KB
testcase_02 AC 44 ms
163,388 KB
testcase_03 AC 43 ms
163,404 KB
testcase_04 AC 44 ms
163,376 KB
testcase_05 AC 45 ms
163,384 KB
testcase_06 AC 44 ms
163,348 KB
testcase_07 AC 276 ms
163,436 KB
testcase_08 AC 247 ms
163,388 KB
testcase_09 AC 181 ms
163,420 KB
testcase_10 AC 206 ms
163,360 KB
testcase_11 AC 259 ms
163,448 KB
testcase_12 AC 44 ms
163,328 KB
testcase_13 AC 43 ms
163,348 KB
testcase_14 AC 227 ms
163,392 KB
testcase_15 AC 265 ms
163,416 KB
testcase_16 AC 44 ms
163,488 KB
testcase_17 AC 95 ms
163,352 KB
testcase_18 AC 257 ms
163,456 KB
testcase_19 AC 67 ms
163,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
 
using namespace std;

bool dp[5001][32768];

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n,t;
	vector <int> v;

	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		v.push_back(t);
	}

	memset(dp,false,sizeof(dp));

	dp[0][0] = true;

	for(int i=0;i<n;i++)
	{
		for(int j=0;j<32768;j++)
		{
			if(dp[i][j]==false)
			{
				continue;
			}
			dp[i+1][j] = true;
			dp[i+1][j^v[i]] = true;
		}
	}

	int res = 0;

	for(int i=0;i<32768;i++)
	{
		if(dp[n][i])
		{
			res++;
		}
	}

	cout << res << '\n';

	return 0;
}
0