結果

問題 No.2895 Zero XOR Subset
ユーザー vjudge1vjudge1
提出日時 2024-09-28 16:54:57
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 893 bytes
コンパイル時間 1,963 ms
コンパイル使用メモリ 171,304 KB
実行使用メモリ 19,144 KB
最終ジャッジ日時 2024-09-28 16:55:05
合計ジャッジ時間 6,469 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;

map<ll,int> mp;

struct node {
	ll x;
	int y;
} a[200001];

bool cmp(node &a,node &b) {
	if(a.x==b.x) return a.y<b.y;
	else {
		return a.x<b.x;
	}
}

void solve() {
	int n;cin>>n;
	for(int i=1;i<=n;++i) {
		cin>>a[i].x;
		a[i].y=i;
	}
	ll x=1;
	for(int i=1;i<=60;++i) {
		x*=2;
		mp[x]=1;
		mp[x-1]=2;
	}
	sort(a+1,a+1+n,cmp);
	bool ok=false;
	if(a[1].x==0) ok=true;
	for(int i=2;i<=n;++i) {
		if(a[i].x==a[i-1].x) {
			cout<<"2 "<<"\n";
			cout<<a[i-1].y<<" "<<a[i].y;
			return;
		}
		else if(mp[a[i].x]==1&&mp[a[i-1].x]==2) {
			cout<<"2 "<<"\n";
			cout<<a[i-1].y<<" "<<a[i].y;
			return;
		}
		else if(ok==true&&mp[a[i].x]==2) {
			cout<<"2 "<<"\n";
			cout<<a[0].y<<" "<<a[i].y;
			return;
		}
	}
	cout<<"-1";
}
 
int main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int _;_=1;
	while(_--) solve();
	return 0;
}
0