結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー snrnsidysnrnsidy
提出日時 2021-05-27 02:03:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 203 ms / 5,000 ms
コード長 585 bytes
コンパイル時間 2,538 ms
コンパイル使用メモリ 207,780 KB
実行使用メモリ 163,700 KB
最終ジャッジ日時 2024-04-23 19:00:17
合計ジャッジ時間 5,300 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
163,608 KB
testcase_01 AC 42 ms
163,596 KB
testcase_02 AC 42 ms
163,492 KB
testcase_03 AC 41 ms
163,500 KB
testcase_04 AC 41 ms
163,684 KB
testcase_05 AC 41 ms
163,496 KB
testcase_06 AC 42 ms
163,460 KB
testcase_07 AC 203 ms
163,592 KB
testcase_08 AC 182 ms
163,700 KB
testcase_09 AC 138 ms
163,380 KB
testcase_10 AC 158 ms
163,676 KB
testcase_11 AC 193 ms
163,644 KB
testcase_12 AC 42 ms
163,512 KB
testcase_13 AC 41 ms
163,508 KB
testcase_14 AC 167 ms
163,524 KB
testcase_15 AC 198 ms
163,552 KB
testcase_16 AC 42 ms
163,328 KB
testcase_17 AC 77 ms
163,508 KB
testcase_18 AC 194 ms
163,536 KB
testcase_19 AC 58 ms
163,580 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