結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー jimmyo0705jimmyo0705
提出日時 2018-09-25 15:32:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 247 ms / 5,000 ms
コード長 1,553 bytes
コンパイル時間 591 ms
コンパイル使用メモリ 89,448 KB
実行使用メモリ 163,436 KB
最終ジャッジ日時 2023-09-13 20:12:04
合計ジャッジ時間 3,509 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 224 ms
145,396 KB
testcase_08 AC 220 ms
146,048 KB
testcase_09 AC 150 ms
100,820 KB
testcase_10 AC 182 ms
120,856 KB
testcase_11 AC 238 ms
158,028 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 247 ms
163,372 KB
testcase_15 AC 246 ms
163,436 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 56 ms
40,188 KB
testcase_18 AC 212 ms
141,804 KB
testcase_19 AC 29 ms
21,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;
int a[5000];

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

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

0