結果

問題 No.2895 Zero XOR Subset
ユーザー cho435cho435
提出日時 2024-09-20 21:50:23
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,166 bytes
コンパイル時間 4,676 ms
コンパイル使用メモリ 266,476 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-20 21:50:45
合計ジャッジ時間 11,535 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#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();
			}
			cout<<ans.size()<<"\n";
			for(int d:ans) cout<<d+1<<" ";
			cout<<"\n";
			return 0;
		}
		b.push_back(x);
		ck.push_back({i,v});
	}
	cout<<"-1\n";
}
0