为什么这份代码提交显示运行错误?
题目链接:http://acm.xidian.#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<iomanip>
#define LL long long
#define pi 3.14159
using namespace std;
int n;
LL a[200010],p[35],ans[5];
set<LL> s;
void init(){
int i;
LL s=1;;
p[0]=1;
for(i=1;i<=31;i++){
s*=2;
p[i]=s;
}
}
int main(void){
int i,j,l;
init();
while(scanf("%d",&n)!=EOF){
s.clear();
for(i=1;i<=n;i++){
scanf("%lld",&a[i]);
s.insert(a[i]);
}
sort(a+1,a+1+n);
l=0;
for(i=1;i<=n;i++){
if(i!=1 && a[i]==a[i-1]) continue;
for(j=0;j<=31;j++){
if(s.count(a[i]+p[j]) && s.count(a[i]+2*p[j])){
ans[l]=a[i];
l++;
ans[l]=a[i]+p[j];
l++;
ans[l]=a[i]+2*p[j];
break;
}
if(l==0 && s.count(a[i]+p[j])){
ans[l]=a[i];
l++;
ans[l]=a[i]+p[j];
}
}
if(l==2) break;
}
if(l==0) printf("1\n%lld\n",a[1]);
else if(l==1){
printf("2\n%lld %lld\n",ans[0],ans[1]);
}
else printf("3\n%lld %lld %lld\n",ans[0],ans[1],ans[2]);
}
return 0;
}