結果
問題 |
No.2895 Zero XOR Subset
|
ユーザー |
|
提出日時 | 2024-09-20 21:45:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 925 bytes |
コンパイル時間 | 2,063 ms |
コンパイル使用メモリ | 206,228 KB |
最終ジャッジ日時 | 2025-02-24 10:01:43 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 WA * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; random_device rnd; mt19937 mt(rnd()); int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<long long> A(N); for(auto &a : A) cin >> a; vector<pair<long long,long long>> base; for(int i=0; i<N; i++){ assert(i <= 60); long long a = A.at(i),now = 1LL<<i; for(auto [b,s] : base) if(a > (a^b)) a = a^b,now ^= s; if(a == 0){ vector<int> answer; for(int k=0; k<60; k++) if(now&(1LL<<k)) answer.push_back(k+1); cout << answer.size() << endl; for(int k=0; k<answer.size(); k++) cout << answer.at(k) << (k+1==answer.size()?"\n":" "); return 0; } for(auto &[b,s] : base) if(b > (b^a)) b = b^a,s ^= now; base.push_back({a,now}); sort(base.rbegin(),base.rend()); } cout << "-1" << endl; }