結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー yuma220284yuma220284
提出日時 2019-08-10 11:47:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 256 ms / 5,000 ms
コード長 444 bytes
コンパイル時間 1,539 ms
コンパイル使用メモリ 143,908 KB
実行使用メモリ 162,440 KB
最終ジャッジ日時 2023-09-15 12:31:45
合計ジャッジ時間 4,374 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 2 ms
4,376 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 AC 254 ms
145,940 KB
testcase_08 AC 226 ms
145,872 KB
testcase_09 AC 157 ms
101,076 KB
testcase_10 AC 188 ms
121,340 KB
testcase_11 AC 247 ms
158,404 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 220 ms
161,412 KB
testcase_15 AC 256 ms
162,440 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 58 ms
39,360 KB
testcase_18 AC 234 ms
141,792 KB
testcase_19 AC 30 ms
21,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

int main() {
	static int N, A[5000], COUNT = 0;
	static bool DP[5010][32768] = {};
	DP[0][0] = true;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 32768; j++) {
			if (DP[i][j]) {
				DP[i + 1][j ^ A[i]] = true;
				DP[i + 1][j] = true;
			}
		}
	}
	for (int i = 0; i < 32768; i++) {
		if (DP[N][i]) COUNT++;
	}
	cout << COUNT << endl;
}
0