結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-07-30 22:14:06
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 615 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 64,244 KB
実行使用メモリ 86,144 KB
最終ジャッジ日時 2024-04-24 13:14:34
合計ジャッジ時間 3,418 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 146 ms
77,184 KB
testcase_09 AC 97 ms
53,888 KB
testcase_10 AC 120 ms
64,256 KB
testcase_11 AC 157 ms
83,456 KB
testcase_12 WA -
testcase_13 AC 2 ms
5,376 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 33 ms
21,560 KB
testcase_18 WA -
testcase_19 AC 18 ms
12,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

bool contain(int i, int pos){
	if(i & (1 << pos)) return true;
	else return false;
}

bool dp[5000][17000] = {0};

int main(void){
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	dp[0][0] = true;
	for (int i = 0; i < n; ++i){
		for (int j = 0; j <= 16384; ++j){
			if(dp[i][j]){
				dp[i + 1][j] = true;
				int x = j ^ a[i];
				dp[i + 1][x] = true;
			} 
		}
	}
	int ans = 0;
	rep(i, 17000) if(dp[n][i]) ans++;
	cout << ans << endl;
	return 0;
}
0