結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー nejineji
提出日時 2021-02-03 21:11:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 69 ms / 5,000 ms
コード長 1,125 bytes
コンパイル時間 3,792 ms
コンパイル使用メモリ 229,136 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 04:47:03
合計ジャッジ時間 6,863 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define REP(i, x, y) for (ll i = x; i <= y; i++)
#define BIT(t) (1ll << (t))
#define PER(i, y, x) for (ll i = y; i >= x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pll pair<ll, ll>
#define SIZE(v) ll(v.size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef long double ld;
//        ios::sync_with_stdio(false);
//        cin.tie(nullptr);

using mint = modint;
//         mint::set_mod(998244353);

vll xor_basis(vll& a){
        vector<ll> basis;
        for(ll e : a){
                for(ll b : basis){
                        e = min(e, e ^ b);
                }
                if(e){basis.push_back(e);}        
        }
return basis;
}
int main(){
        ll n;
        cin >> n;
        vll a;
        REP(i,1,n){
                ll t;
                cin >> t;
                a.push_back(t);
        }
        vll b = xor_basis(a);
        ll ans = 1;
        REP(i,1,b.size()){
                ans *= 2;
        }
        cout << ans << endl;
}
0