結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー Kosukekim
提出日時 2020-10-29 11:18:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 101 ms / 5,000 ms
コード長 736 bytes
コンパイル時間 3,816 ms
コンパイル使用メモリ 228,616 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-21 22:32:17
合計ジャッジ時間 7,797 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
using R=double;
using ld = long double;
int INF = 1e9;
ll LINF = 1e18;
int mod = 1000000007;
int mod2 = 1;
using graph = vector<vector<int>>;
using mint = modint1000000007;

int main(){
	int n;cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	int ans = 0;
	rep(i,n){
		if(a[i] == 0) continue;
		ans++;
		int x = 0;
		while(1LL<<(x+1) <= a[i]) x++;
		for(int j = i+1;j < n;j++){
			if(a[j] & (1LL<<x)) a[j] ^= a[i];
		}
	}

	cout << (1LL<< ans) << endl;  
}

0