結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー miyo2580miyo2580
提出日時 2024-02-14 17:06:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 49 ms / 5,000 ms
コード長 1,016 bytes
コンパイル時間 2,098 ms
コンパイル使用メモリ 203,828 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-14 17:06:39
合計ジャッジ時間 4,579 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 35 ms
6,676 KB
testcase_09 AC 9 ms
6,676 KB
testcase_10 AC 27 ms
6,676 KB
testcase_11 AC 20 ms
6,676 KB
testcase_12 AC 41 ms
6,676 KB
testcase_13 AC 45 ms
6,676 KB
testcase_14 AC 26 ms
6,676 KB
testcase_15 AC 48 ms
6,676 KB
testcase_16 AC 40 ms
6,676 KB
testcase_17 AC 43 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 12 ms
6,676 KB
testcase_21 AC 49 ms
6,676 KB
testcase_22 AC 49 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 2 ms
6,676 KB
testcase_27 AC 2 ms
6,676 KB
testcase_28 AC 30 ms
6,676 KB
testcase_29 AC 41 ms
6,676 KB
testcase_30 AC 37 ms
6,676 KB
testcase_31 AC 32 ms
6,676 KB
testcase_32 AC 39 ms
6,676 KB
testcase_33 AC 48 ms
6,676 KB
testcase_34 AC 47 ms
6,676 KB
testcase_35 AC 49 ms
6,676 KB
testcase_36 AC 48 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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,61){
      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;
}
0