結果

問題 No.184 たのしい排他的論理和(HARD)
コンテスト
ユーザー y_mazun
提出日時 2015-04-17 00:06:32
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 707 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 484 ms
コンパイル使用メモリ 63,232 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-25 18:53:29
合計ジャッジ時間 2,165 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <queue>
typedef long long ll;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

/*
y1 = x00 * x0 + x10 * x1 + ... + xn0 * xn
y2 = x01 * x0 + x11 * x1 + ... + xn1 * xn
...
yk = x0k * x0 + x1k * x1 + ... + xnk * xn

 */

int main(){
  const int n = getInt();
  vector<ll> a(n);
  REP(i,n) scanf("%lld", &a[i]);

  ll ans = 1;
  REP(i,62){
    int p = 0;
    for(; p < n; p++)
      if(a[p] & (1ll << i))
        break;
    if(p == n) continue;
    ans *= 2;

    REP(j,n) if(a[j] & (1ll << i)){
      a[j] = (a[j] ^ a[p]) | (1ll << i);
    }
  }

  printf("%lld\n", ans);

  return 0;
}
0