結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー Min_25Min_25
提出日時 2016-07-11 21:14:35
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 1,401 bytes
コンパイル時間 1,179 ms
コンパイル使用メモリ 90,972 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 17:31:55
合計ジャッジ時間 3,522 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 28 ms
4,376 KB
testcase_09 AC 7 ms
4,376 KB
testcase_10 AC 22 ms
4,380 KB
testcase_11 AC 16 ms
4,380 KB
testcase_12 AC 32 ms
4,376 KB
testcase_13 AC 34 ms
4,380 KB
testcase_14 AC 21 ms
4,376 KB
testcase_15 AC 37 ms
4,380 KB
testcase_16 AC 31 ms
4,380 KB
testcase_17 AC 34 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 39 ms
4,380 KB
testcase_22 AC 38 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 23 ms
4,376 KB
testcase_29 AC 32 ms
4,380 KB
testcase_30 AC 28 ms
4,380 KB
testcase_31 AC 24 ms
4,380 KB
testcase_32 AC 30 ms
4,380 KB
testcase_33 AC 37 ms
4,380 KB
testcase_34 AC 37 ms
4,376 KB
testcase_35 AC 38 ms
4,380 KB
testcase_36 AC 39 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O3")
// #pragma GCC target ("avx") // yukicoder
#pragma GCC target ("sse4") // SPOJ, codechef

#include <cstdio>
#include <cassert>
#include <cmath>
#include <cstring>

#include <complex>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <tuple>

#define _rep(_1, _2, _3, _4, name, ...) name
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, c) for (int i = int(a); i < int(b); i += int(c))
#define rep(...) _rep(__VA_ARGS__, rep4, rep3, rep2, _)(__VA_ARGS__)

using namespace std;

using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f80 = long double; 

#define getchar getchar_unlocked

i64 get_i64() {
  i64 n; int c;
  while ((c = getchar()) < '0');
  n = c - '0';
  while ((c = getchar()) >= '0') n = n * 10 + c - '0';
  return n;
}

using P = pair<i64, i64>;
P bases[64];

void solve() {
  int n;
  while (~scanf("%d", &n)) {
    int rank = 0;
    rep(_, n) {
      i64 a = get_i64();
      rep(i, rank) if (a & bases[i].first) a ^= bases[i].second;
      if (a) bases[rank++] = {a & -a, a};
    }
    printf("%lld\n", i64(1) << rank);
  }
}

int main() {
  clock_t beg = clock();
  solve();
  clock_t end = clock();
  fprintf(stderr, "%.3f sec\n", double(end - beg) / CLOCKS_PER_SEC);
  return 0;
}
0