結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー Div9851KDiv9851K
提出日時 2019-07-16 22:17:21
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 580 bytes
コンパイル時間 1,389 ms
コンパイル使用メモリ 144,452 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-21 09:16:55
合計ジャッジ時間 3,813 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 RE -
testcase_08 AC 116 ms
4,376 KB
testcase_09 AC 80 ms
4,376 KB
testcase_10 AC 96 ms
4,376 KB
testcase_11 AC 126 ms
4,380 KB
testcase_12 RE -
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 97 ms
4,376 KB
testcase_15 AC 130 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 30 ms
4,380 KB
testcase_18 RE -
testcase_19 AC 15 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
bool dp[2][(1 << 14) + 1];
int A[5000];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= (1 << 14); j++) {
			if (!dp[i & 1][j]) continue;
			dp[(i + 1) & 1][j] |= dp[i & 1][j];
			dp[(i + 1) & 1][j^A[i]] |= dp[i & 1][j];
		}
		for (int j = 0; j <= (1 << 14); j++) dp[i & 1][j] = 0;
	}
	int ans = 0;
	for (int i = 0; i <= (1 << 14); i++) if (dp[N & 1][i]) ans++;
	cout << ans << endl;
}
0