結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー cielciel
提出日時 2015-04-17 21:06:19
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 339 ms / 5,000 ms
コード長 764 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 50,624 KB
実行使用メモリ 31,380 KB
最終ジャッジ日時 2023-09-17 16:43:47
合計ジャッジ時間 7,363 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 230 ms
22,940 KB
testcase_09 AC 39 ms
6,924 KB
testcase_10 AC 153 ms
18,128 KB
testcase_11 AC 105 ms
13,724 KB
testcase_12 AC 266 ms
26,380 KB
testcase_13 AC 296 ms
28,496 KB
testcase_14 AC 149 ms
17,340 KB
testcase_15 AC 318 ms
30,628 KB
testcase_16 AC 268 ms
25,932 KB
testcase_17 AC 283 ms
27,652 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 82 ms
31,332 KB
testcase_21 AC 339 ms
31,380 KB
testcase_22 AC 337 ms
31,356 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 179 ms
19,988 KB
testcase_29 AC 268 ms
27,196 KB
testcase_30 AC 227 ms
24,268 KB
testcase_31 AC 183 ms
21,300 KB
testcase_32 AC 253 ms
26,052 KB
testcase_33 AC 321 ms
30,624 KB
testcase_34 AC 318 ms
30,284 KB
testcase_35 AC 335 ms
31,092 KB
testcase_36 AC 328 ms
31,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include "inspect.hpp"
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

int gauss(vector<vector<int> > &a){
	if(a.empty())return 0;
	int w=a[0].size();
	int n=a.size();
	int ret=0;
	for(int i=0;i<w;i++){
		if(!a[ret][i]){
			int j=ret+1;
			for(;j<n;j++){
				if(a[j][i]){
					for(int k=0;k<w;k++)a[ret][k]^=a[j][k];
					break;
				}
			}
			if(j==n)continue;
		}
		for(int j=ret+1;j<n;j++){
			if(a[j][i])for(int k=0;k<w;k++)a[j][k]=a[j][k]^a[ret][k];
		}
		if(++ret==n)break;
	}
	return ret;
}

int main(){
	int N;
	scanf("%d",&N);
	vector<vector<int> >v(N);
	for(int i=0;i<N;i++){
		v[i].resize(64);
		long long n;
		scanf("%lld",&n);
		for(int j=0;n;n/=2,j++)v[i][j]=n%2;
	}
	printf("%lld\n",1LL<<gauss(v));
}
0