結果
問題 |
No.184 たのしい排他的論理和(HARD)
|
ユーザー |
|
提出日時 | 2022-03-13 17:59:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 62 ms / 5,000 ms |
コード長 | 824 bytes |
コンパイル時間 | 1,906 ms |
コンパイル使用メモリ | 196,168 KB |
最終ジャッジ日時 | 2025-01-28 09:22:12 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define bokusunny ios::sync_with_stdio(false), cin.tie(nullptr); template <class T> int GaussJordan_XOR(vector<T> &A) { int N = (int)A.size(); int rank = 0; for (int bit = 62; bit >= 0; bit--) { int pivot = -1; for (int i = rank; i < N; i++) { if (A[i] >> bit & 1) { pivot = i; break; } } if (pivot == -1) continue; for (int i = 0; i < N; i++) { if (i == pivot) continue; if (A[i] >> bit & 1) A[i] ^= A[pivot]; } swap(A[rank], A[pivot]); rank++; } return rank; } void solve() { int N; cin >> N; vector<long long> A(N); for (int i = 0; i < N; i++) cin >> A[i]; auto rank = GaussJordan_XOR(A); cout << (1LL << rank) << endl; } int main() { bokusunny; solve(); return 0; }