結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー takune1024takune1024
提出日時 2017-11-27 23:20:03
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 696 bytes
コンパイル時間 622 ms
コンパイル使用メモリ 67,140 KB
実行使用メモリ 147,016 KB
最終ジャッジ日時 2023-08-18 07:52:37
合計ジャッジ時間 7,252 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 214 ms
144,576 KB
testcase_08 AC 235 ms
122,376 KB
testcase_09 AC 156 ms
94,188 KB
testcase_10 AC 197 ms
106,972 KB
testcase_11 AC 258 ms
129,808 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 59 ms
39,492 KB
testcase_18 AC 221 ms
141,092 KB
testcase_19 AC 29 ms
20,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

typedef pair<int, int> P;
typedef unsigned long long ll;

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))

const int inf = 999999999;
const int mod = 1000000007;

bool dp[5000][1 << 15];

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