結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー ldsyb
提出日時 2017-04-29 17:33:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 260 ms / 5,000 ms
コード長 393 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 65,152 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 01:11:05
合計ジャッジ時間 3,235 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
	int n;
	cin >> n;
	bool dp[1 << 15][2]{};
	dp[0][0] = true;
	for(int i = 0; i < n; i++){
		int a;
		cin >> a;
		for(int j = 0; j < 1 << 15; j++){
			dp[j][1] |= dp[j ^ a][0];
		}
		for(int j = 0; j < 1 << 15; j++){
			dp[j][0] |= dp[j][1];
		}
	}
	int ans = 0;
	for(int i = 0; i < 1 << 15; i++) if(dp[i][0]) ans++;
	cout << ans << endl;
}
0