結果
問題 |
No.184 たのしい排他的論理和(HARD)
|
ユーザー |
![]() |
提出日時 | 2021-02-20 00:08:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 128 ms / 5,000 ms |
コード長 | 1,114 bytes |
コンパイル時間 | 2,042 ms |
コンパイル使用メモリ | 196,452 KB |
最終ジャッジ日時 | 2025-01-19 02:06:34 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> // #include <atcoder/all> #define rep(i,n) for(ll i = 0; i < (n); ++i) #define srep(i,s,t) for(ll i = s; i < t; ++i) #define drep(i,n) for(ll i = (n)-1; i >= 0; --i) using namespace std; // using namespace atcoder; typedef long long int ll; typedef pair<ll,ll> P; #define yn {puts("Yes");}else{puts("No");} #define MAX_N 500005 vector<ll> kitei(vector<ll> a){ int n = a.size(); int now = 0; for(int i = 62; i >= 0; i--){ for(int j = now + 1; j < n; j++){ if(a[j] & (1LL<<i)){ swap(a[now], a[j]); break; } } if(!(a[now] & (1LL<<i))) continue; for(int j = 0; j < n; j++){ if(j != now && (a[j] & (1LL<<i))) a[j] ^= a[now]; } now++; if(now == n) break; } vector<ll> res; for(int i = 0; i < now; i++) res.push_back(a[i]); return res; } int main() { int n; cin >> n; vector<ll> a(n); rep(i,n) cin >> a[i]; vector<ll> v = kitei(a); int m = v.size(); ll ans = 1LL << m; cout << ans << endl; return 0; }