結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー 古寺いろは古寺いろは
提出日時 2015-04-16 23:41:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 382 ms / 5,000 ms
コード長 835 bytes
コンパイル時間 1,292 ms
コンパイル使用メモリ 149,360 KB
実行使用メモリ 55,096 KB
最終ジャッジ日時 2023-09-17 16:19:01
合計ジャッジ時間 8,898 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 265 ms
39,652 KB
testcase_09 AC 41 ms
10,792 KB
testcase_10 AC 182 ms
31,116 KB
testcase_11 AC 115 ms
23,020 KB
testcase_12 AC 306 ms
45,800 KB
testcase_13 AC 337 ms
49,592 KB
testcase_14 AC 168 ms
29,472 KB
testcase_15 AC 372 ms
53,116 KB
testcase_16 AC 289 ms
44,788 KB
testcase_17 AC 327 ms
48,280 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 116 ms
54,972 KB
testcase_21 AC 366 ms
55,096 KB
testcase_22 AC 375 ms
55,064 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 212 ms
34,168 KB
testcase_29 AC 324 ms
47,316 KB
testcase_30 AC 283 ms
42,124 KB
testcase_31 AC 230 ms
36,924 KB
testcase_32 AC 296 ms
45,300 KB
testcase_33 AC 382 ms
53,396 KB
testcase_34 AC 375 ms
52,900 KB
testcase_35 AC 381 ms
54,540 KB
testcase_36 AC 376 ms
54,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<long long> A(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	int ans = 0;

	vector<vector<long long>> matrix(N, vector<long long>(61));

	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < 61; j++)
		{
			matrix[i][j] = (A[i] >> j) % 2;
		}
	}
	vector<int> check(N, 0);
	for (int j = 0; j < 61; j++)
	{
		int start = -1;
		for (int i = 0; i < N; i++)
		{
			if (check[i]) continue;
			if (matrix[i][j] == 1){
				start = i;
				break;
			}
		}
		//cout << j << endl;
		if (start == -1) continue;
		ans++;
		check[start] = 1;
		for (int i = 0; i < N; i++)
		{
			if (check[i]) continue;
			if (matrix[i][j]){
				for (int k = j; k < 61; k++)
				{
					matrix[i][k] ^= matrix[start][k];
				}
			}
		}
	}


	cout << (1ll << ans) << endl;
}
0