結果
| 問題 |
No.184 たのしい排他的論理和(HARD)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-14 17:05:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,016 bytes |
| コンパイル時間 | 2,322 ms |
| コンパイル使用メモリ | 193,648 KB |
| 最終ジャッジ日時 | 2025-02-19 13:06:12 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
using Graph = vector<vector<ll>>;
const long long INF = 1LL<<60;
const long long MOD = 1000000007;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
ll n;cin>>n;
vec a(n);
rep(i,n)cin>>a[i];
ll cnt=0;
ll ans=1;
rep(i,60){
ll idx=-1;
repd(j,cnt,n){
if((a[j]>>i)&1){
idx=j;
break;
}
}
if(idx==-1)continue;
swap(a[idx],a[cnt]);
repd(j,cnt+1,n){
if((a[j]>>i)&1){
a[j]^=a[cnt];
}
}
ans*=2;
cnt++;
}
cout<<ans<<endl;
return 0;
}