結果
| 問題 |
No.2895 Zero XOR Subset
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-20 21:53:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,173 bytes |
| コンパイル時間 | 4,369 ms |
| コンパイル使用メモリ | 255,592 KB |
| 最終ジャッジ日時 | 2025-02-24 10:05:47 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | WA * 35 |
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
template<typename T>
bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; }
template<typename T>
bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; }
struct io_setup {
io_setup() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout << fixed << setprecision(15);
}
} io_setup;
int main(){
int n;
cin>>n;
vector<int> a(n);
rep(i,0,n) cin>>a.at(i);
vector<int> b;
vector<pair<int,vector<int>>> ck;
rep(i,0,n){
int x=a.at(i);
vector<int> v;
int ct=0;
for(int y:b){
if(chmin(x,x^y)) v.push_back(ct);
ct++;
}
if(x==0){
vector<int> ans;
ans.push_back(i);
int m=b.size();
vector<int> us(m,0);
for(int d:v) us.at(d)^=1;
while(!us.empty()){
if(us.back()){
auto[dd,tv]=ck.back();
ans.push_back(dd);
for(int d:tv) us.at(d)^=1;
}
us.pop_back();
ck.pop_back();
}
m=ans.size();
cout<<m<<"\n";
rep(j,0,m) cout<<ans.at(j)+1<<" \n"[j==m-1];
return 0;
}
b.push_back(x);
ck.push_back({i,v});
}
cout<<"-1\n";
}