結果
問題 |
No.184 たのしい排他的論理和(HARD)
|
ユーザー |
![]() |
提出日時 | 2021-03-13 16:49:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 670 bytes |
コンパイル時間 | 1,675 ms |
コンパイル使用メモリ | 194,904 KB |
最終ジャッジ日時 | 2025-01-19 16:11:15 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 WA * 4 |
ソースコード
#include <bits/stdc++.h> #define REP(i, s, n) for (int i = s; i < (int)(n); i++) #define ALL(a) a.begin(), a.end() #define MOD 1000000007 using namespace std; using ll = long long; int main() { int N; cin >> N; vector<ll> A(N); REP(i, 0, N) cin >> A[i]; int rank = 0; for (int i = 60; i >= 0; i--) { REP(j, rank + 1, N) { if (A[j] & (1LL << i)) { swap(A[j], A[rank]); break; } } if (!(A[rank] & (1LL << i))) continue; REP(j, 0, N) if (j != rank && A[j] & (1LL << i)) A[j] ^= A[rank]; rank++; } cout << (1LL << rank) << endl; return 0; }