QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#535536 | #6345. Random Interactive Convex Hull Bot | World_Creater | Compile Error | / | / | C++14 | 1.2kb | 2024-08-28 09:30:00 | 2024-08-28 09:30:01 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
vector<int>an,ans;
int vs[5005];
int query(int a,int b,int c)
{
cout<<"? "<<a<<" "<<b<<" "<<c<<endl;
int t;
cin>>t;
return t;
}
void sol(int x){
for(int i=0;i<an.size();++i)vs[i]=0;int si=an.size();int o=(x+1)%si;
while(query(an[x],an[o],an[(o+1)%si])<0)vs[o]=1,o=(o+1)%si;
o=(x-1+si)%si;
while(query(an[x],an[o],an[(o+si-1)%si])>0)vs[o]=1,o=(o+si-1)%si;
ans.clear();
for(int i=0;i<si;++i)if(!vs[i])ans.push_back(an[i]);
an=ans;
}
int main()
int n;
cin>>n;
an.clear();
if(query(1,2,3)<0)an.push_back(1),an.push_back(3),an.push_back(2);
else an.push_back(1),an.push_back(2),an.push_back(3);
for(int i=4;i<=n;++i){
if(query(an[0],an[1],i)<0)an.insert(an.begin()+1,i),sol(1);
else{
int l=2,r=an.size();
while(l<r){
int md=l+r>>1;
if(query(an[0],an[md],i)<0)r=md;else l=md+1;
}
if(l==an.size()){
an.push_back(i),sol(an.size()-1);
}else if(query(an[l-1],an[l],i)<0){
an.insert(an.begin()+l,i),sol(l);
}
}
}
cout<<"! "<<an.size()<<" ";
for(auto i:an)
{
cout<<i<<" ";
}
cout<<endl;
}//query(a,b,c):c on ab right:-1
详细
answer.code:22:5: error: expected initializer before ‘int’ 22 | int n; | ^~~ answer.code:23:5: error: ‘cin’ does not name a type 23 | cin>>n; | ^~~ answer.code:24:9: error: ‘an’ does not name a type 24 | an.clear(); | ^~ answer.code:25:9: error: expected unqualified-id before ‘if’ 25 | if(query(1,2,3)<0)an.push_back(1),an.push_back(3),an.push_back(2); | ^~ answer.code:26:9: error: expected unqualified-id before ‘else’ 26 | else an.push_back(1),an.push_back(2),an.push_back(3); | ^~~~ answer.code:27:9: error: expected unqualified-id before ‘for’ 27 | for(int i=4;i<=n;++i){ | ^~~ answer.code:27:21: error: ‘i’ does not name a type 27 | for(int i=4;i<=n;++i){ | ^ answer.code:27:26: error: expected unqualified-id before ‘++’ token 27 | for(int i=4;i<=n;++i){ | ^~ answer.code:42:5: error: ‘cout’ does not name a type 42 | cout<<"! "<<an.size()<<" "; | ^~~~ answer.code:43:5: error: expected unqualified-id before ‘for’ 43 | for(auto i:an) | ^~~ answer.code:47:5: error: ‘cout’ does not name a type 47 | cout<<endl; | ^~~~ answer.code:48:1: error: expected declaration before ‘}’ token 48 | }//query(a,b,c):c on ab right:-1 | ^