結果
| 問題 |
No.2895 Zero XOR Subset
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-09-28 16:58:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 896 bytes |
| コンパイル時間 | 1,462 ms |
| コンパイル使用メモリ | 171,012 KB |
| 実行使用メモリ | 19,140 KB |
| 最終ジャッジ日時 | 2024-09-28 16:58:30 |
| 合計ジャッジ時間 | 6,838 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 WA * 21 |
ソースコード
#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&&a[i].x-1==a[i-1].x) {
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[1].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;
}
vjudge1