結果
| 問題 |
No.2895 Zero XOR Subset
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-20 21:52:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 861 bytes |
| コンパイル時間 | 1,969 ms |
| コンパイル使用メモリ | 200,392 KB |
| 最終ジャッジ日時 | 2025-02-24 10:04:40 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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++){
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});
}
cout << "-1" << endl;
}