QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#535843#6345. Random Interactive Convex Hull BotfzxWA 1ms3816kbC++141.2kb2024-08-28 15:35:492024-08-28 15:35:50

Judging History

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

  • [2024-08-28 15:35:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3816kb
  • [2024-08-28 15:35:49]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
using namespace std;
mt19937 rnd(114514);
int gen(int l,int r) {return rnd()%(r-l+1)+l;}
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;
	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;
	}
	reverse(v.begin(),v.end());
	cout<<"! ";
	cout<<v.size()<<" ";
	for (int i:v) cout<<i<<" ";
	cout<<"\n";
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3816kb

input:

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

output:

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

result:

wrong answer incorrect hull, 12 queries