結果
| 問題 |
No.184 たのしい排他的論理和(HARD)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-16 00:08:33 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,033 bytes |
| コンパイル時間 | 2,410 ms |
| コンパイル使用メモリ | 130,408 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-16 00:08:39 |
| 合計ジャッジ時間 | 4,883 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 WA * 1 |
ソースコード
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <sstream>
#include <bitset>
#include <ranges>
using namespace std;
using ll = long long;
auto range(int n) { return views::iota(0, n); }
const int M = 100000;
const int N = 60;
using Row = bitset<M>;
Row A[N];
int main() {
int m; cin >> m;
for (int j : range(m)) {
ll a; cin >> a;
for (int i : range(N)) A[i][j] = (a >> i) & 1;
}
int piv = 0;
for (int j : range(m)) {
bool found = 0;
for (int i : views::iota(piv, N)) {
if (A[i][j]) {
found = 1;
swap(A[i], A[piv]);
break;
}
}
if (!found) {
int parity = 0;
for (int i : range(piv)) parity ^= A[i][j];
continue;
}
for (int i : range(N)) if (i != piv) {
if (A[i][j]) A[i] ^= A[piv];
}
piv++;
}
const int s = piv; // s is the rank of [A[0] A[1] ... A[m - 1]]
ll ans = 1LL << s;
cout << ans << endl;
}