結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー ssssskkkkkssssskkkkk
提出日時 2017-11-28 18:12:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 271 ms / 5,000 ms
コード長 404 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 67,952 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 15:31:10
合計ジャッジ時間 3,070 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 188 ms
4,380 KB
testcase_08 AC 188 ms
4,380 KB
testcase_09 AC 129 ms
4,380 KB
testcase_10 AC 155 ms
4,376 KB
testcase_11 AC 204 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 271 ms
4,376 KB
testcase_15 AC 210 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 48 ms
4,376 KB
testcase_18 AC 182 ms
4,380 KB
testcase_19 AC 24 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
const int _max = 1 << 15;
int N;
int dp[2][_max];
int main(void) {
	cin >> N;
	dp[0][0] = true;
	for (int n = 1; n <= N; ++n) {
		int a; cin >> a;
		for (int i = 0; i < _max; ++i) {
			dp[n % 2][i] |= dp[(n - 1) % 2][i];
			dp[n % 2][i ^ a] |= dp[(n - 1) % 2][i];
		}
	}
	cout << count(dp[N % 2], dp[N % 2] + _max, true) << endl;
	return 0;
}
0