QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#535858#6345. Random Interactive Convex Hull BotfzxWA 0ms3516kbC++141.3kb2024-08-28 15:50:422024-08-28 15:50:48

Judging History

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

  • [2024-08-28 15:50:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3516kb
  • [2024-08-28 15:50:42]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int INF=1e6+5;
int vis5[INF],n;
int query(int x,int y,int z) {
	cout<<"? "<<x<<" "<<y<<" "<<z<<endl;
	int xx=0;cin>>xx;
	if (xx==1) xx=-1;
	else xx=1;
	return xx;
}
signed main()
{	
	cin>>n;
	vector <int> v;
	if (query(1,2,3)==-1) {v.pb(1);v.pb(2);v.pb(3);}
	else {v.pb(1);v.pb(3);v.pb(2);}
	for (int i=4;i<=n;i++) {
		int len=v.size();
		for (int j=0;j<len;j++) vis5[j]=0;
		int l=1,r=len-1,ans=len;
		while (l<=r) {
			int Mid=(l+r)>>1;
			if (query(v[0],v[Mid],i)==1) r=(ans=Mid)-1;
			else l=Mid+1;
		}
		ans--;
		int id=ans;
		if (query(v[id],v[(id+1)%len],i)==-1) continue;
		vis5[id]++;vis5[(id+1)%len]++;
		int L=id,R=(id+1)%len;
		while (query(v[(L+len-1)%len],v[L],i)==1) L+=len-1,L%=len,vis5[L]++,vis5[(L+1)%len]++;
		while (query(v[R],v[(R+1)%len],i)==1) vis5[R]++,vis5[(R+1)%len]++,R++,R%=len;
		vector <int> v3;
		int fl=1;
		for (int j=0;j<len;j++) {
			if (vis5[j]<=1) v3.pb(v[j]);
			if (vis5[j] && vis5[(j+1)%len]) {if (fl) v3.pb(i);fl=0;}
		}
		v=v3;
		// cout<<v.size()<<" ";
		// for (int i:v) cout<<i<<" ";
		// cout<<"\n";
	}
	reverse(v.begin(),v.end());
	cout<<"! ";
	cout<<v.size()<<" ";
	for (int i:v) cout<<i<<" ";
	cout<<"\n";
	cout<<endl;
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3516kb

input:

5
-1
-1
-1
1
-1
1
1
-1
-1
1
1

output:

? 1 2 3
? 1 3 4
? 1 3 4
? 2 1 4
? 3 2 4
? 2 1 4
? 1 4 5
? 1 2 5
? 4 2 5
? 1 4 5
? 2 1 5
! 4 2 5 4 1 


result:

wrong answer incorrect hull, 11 queries