QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#535533#6345. Random Interactive Convex Hull BotWorld_CreaterCompile Error//C++141.2kb2024-08-28 09:29:282024-08-28 09:29:28

Judging History

你现在查看的是最新测评结果

  • [2024-08-28 09:29:28]
  • 评测
  • [2024-08-28 09:29:28]
  • 提交

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;
}
vector<int> convex(int 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: In function ‘std::vector<int> convex(int)’:
answer.code:46:1: warning: no return statement in function returning non-void [-Wreturn-type]
   46 | }//query(a,b,c):c on ab right:-1
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status