結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー tarakojo1019tarakojo1019
提出日時 2021-01-18 18:18:37
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 103 ms / 5,000 ms
コード長 1,307 bytes
コンパイル時間 1,146 ms
コンパイル使用メモリ 113,936 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-21 01:32:41
合計ジャッジ時間 5,209 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 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 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 74 ms
4,380 KB
testcase_09 AC 16 ms
4,380 KB
testcase_10 AC 56 ms
4,380 KB
testcase_11 AC 41 ms
4,380 KB
testcase_12 AC 85 ms
4,384 KB
testcase_13 AC 92 ms
4,376 KB
testcase_14 AC 53 ms
4,376 KB
testcase_15 AC 100 ms
4,500 KB
testcase_16 AC 83 ms
4,376 KB
testcase_17 AC 90 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 15 ms
4,380 KB
testcase_21 AC 103 ms
4,376 KB
testcase_22 AC 103 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 62 ms
4,380 KB
testcase_29 AC 87 ms
4,380 KB
testcase_30 AC 76 ms
4,376 KB
testcase_31 AC 66 ms
4,376 KB
testcase_32 AC 82 ms
4,380 KB
testcase_33 AC 100 ms
4,380 KB
testcase_34 AC 100 ms
4,380 KB
testcase_35 AC 102 ms
4,380 KB
testcase_36 AC 102 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<numeric>
#include<cstring>
#include<random>
#include<array>
#include<fstream>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include<queue>

/*
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) std::cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", (double)v)

template<typename A, typename B>void mins(A& a, const B& b) { a = min(a, (A)b); };
template<typename A, typename B>void maxs(A& a, const B& b) { a = max(a, (A)b); };




//F2^64の部分空間を基底で管理
struct xor_space {
	std::vector<uint64_t> basis;
	bool in(uint64_t x) {
		for (uint64_t b : basis) if ((b ^ x) < x) x = b ^ x;
		return x == 0;
	}
	void add(uint64_t x) {
		for (uint64_t b : basis) if ((b ^ x) < x) x = b ^ x;
		if (x != 0) basis.push_back(x);
	}
};

int main() {
	ll N; cin >> N;
	xor_space s;
	REP(i, 0, N) {
		ll a; cin >> a;
		s.add(a);
	}
	PRI((1LL << s.basis.size()));
	return 0;
}
0