結果
| 問題 | No.2895 Zero XOR Subset |
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2024-11-13 15:16:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 998 bytes |
| コンパイル時間 | 2,148 ms |
| コンパイル使用メモリ | 199,580 KB |
| 最終ジャッジ日時 | 2025-02-25 04:04:43 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll N, A;
cin >> N;
vector<pair<ll, ll>> vec(N);
vector<pair<ll, ll>> base;
for (int i=0; i<N; i++){
cin >> A;
vec[i] = {A, (i<=60 ? (1LL<<i) : -1)};
}
for (int i=0; i<N; i++){
for (auto [e, x] : base){
if ((vec[i].first^e) < vec[i].first){
vec[i].first ^= e;
vec[i].second ^= x;
}
}
if (vec[i].first) base.push_back(vec[i]);
else{
vector<ll> ans;
for (int j=0; j<=60; j++){
if (vec[i].second & (1LL<<j)){
ans.push_back(j+1);
}
}
cout << ans.size() << endl;
for (auto x : ans) cout << x << " ";
cout << endl;
return 0;
}
}
cout << -1 << endl;
return 0;
}
srjywrdnprkt