結果
| 問題 | No.184 たのしい排他的論理和(HARD) |
| コンテスト | |
| ユーザー |
Min_25
|
| 提出日時 | 2016-07-11 21:14:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 5,000 ms |
| コード長 | 1,401 bytes |
| 記録 | |
| コンパイル時間 | 1,350 ms |
| コンパイル使用メモリ | 94,404 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 12:10:58 |
| 合計ジャッジ時間 | 3,712 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#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;
}
Min_25