結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー puni_kyopropuni_kyopro
提出日時 2019-10-17 15:39:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 2,875 bytes
コンパイル時間 1,011 ms
コンパイル使用メモリ 103,056 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-15 14:33:53
合計ジャッジ時間 2,752 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 113 ms
4,380 KB
testcase_08 AC 118 ms
4,384 KB
testcase_09 AC 80 ms
4,380 KB
testcase_10 AC 98 ms
4,380 KB
testcase_11 AC 129 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 127 ms
4,380 KB
testcase_15 AC 135 ms
4,380 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 30 ms
4,380 KB
testcase_18 AC 112 ms
4,380 KB
testcase_19 AC 16 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<bitset>
#include<stack>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;

int dy[8] = { 2,2,-2,-2,1,1,-1,-1 };
int dx[8] = { 1,-1,1,-1,2,-2,2,-2 };



/******************************************************************************************/


const int IINF = 1e9 + 7;
const ll LINF = 1e18 + 7;
const ll MOD = 998244353;



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

// vector
template <typename T>
istream& operator>>(istream & is, vector<T> & vec) { for (T& x : vec) is >> x; return is; }
// pair
template <typename T, typename U>ostream& operator<<(ostream & os, pair<T, U> & pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; }
// vector
template <typename T>ostream& operator<<(ostream & os, const vector<T> & vec) { os << "{";	for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); }os << "}"; return os; }
// map
template <typename T, typename U>ostream& operator<<(ostream & os, map<T, U> & map_var) { os << "{";	repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; }os << "}"; return os; }
// set
template <typename T>ostream& operator<<(ostream & os, set<T> & set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; }os << "}"; return os; }



int dp[1<<16];

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	vector<int> A(N);

	
	int maxi = 0;
	int X = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	dp[0] = 1;
	
	for (int i = 0; i < N; i++)
	{
		for (int j = (1 << 15); j >= 0; j--)
		{
			if (dp[j] == 0)continue;
			dp[j ^ A[i]] = 1;
		}
	}

	int sum = 0;

	for (int i = 0; i < (1 << 15); i++)
	{
		sum += dp[i];
	}
	cout << sum << endl;

}
0