結果
問題 | No.184 たのしい排他的論理和(HARD) |
ユーザー |
![]() |
提出日時 | 2021-11-03 22:39:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 117 ms / 5,000 ms |
コード長 | 793 bytes |
コンパイル時間 | 4,555 ms |
コンパイル使用メモリ | 251,716 KB |
最終ジャッジ日時 | 2025-01-25 11:14:04 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 vector<long long> func(vector<long long> A){ int last = 0; for(long long i=60;i>=0;i--){ int ind = -1; for(int j=last;j<A.size();j++){ if((A[j]>>i) & 1LL){ ind = j; break; } } if(ind==-1)continue; for(int j=0;j<A.size();j++){ if(j!=ind){ if((A[j]>>i)&1LL){ A[j] ^= A[ind]; } } } swap(A[last],A[ind]); last++; } while(A.size()!=0&&A.back()==0)A.pop_back(); return A; } int main(){ int n; cin>>n; vector<long long> a(n); rep(i,n)cin>>a[i]; a = func(a); long long ans = 1LL << a.size(); cout<<ans<<endl; return 0; }