QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#535526 | #6345. Random Interactive Convex Hull Bot | World_Creater | WA | 0ms | 3712kb | C++14 | 1.0kb | 2024-08-28 09:16:41 | 2024-08-28 09:16:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
int n,p[5001],tmp[5001];
int query(int a,int b,int c)
{
cout<<"? "<<a<<" "<<b<<" "<<c<<endl;
int t;
cin>>t;
return t;
}
void solve(int l,int r){
if (l>=r) return;
int x=rnd()%(r-l+1)+l,top=l-1,tt=r+1;
for (int i=l;i<=r;++i) tmp[i]=p[i];
for (int i=l;i<=r;++i) if (i!=x && query(1,tmp[x],tmp[i])==-1) p[++top]=tmp[i];
else if (i!=x) p[--tt]=tmp[i];
p[++top]=tmp[x];
solve(l,top-1),solve(top+1,r);
}
int main()
{
cin>>n;
for (int i=1;i<n;++i) p[i]=i+1;
solve(1,n-1);
int top=0;
for (int i=1;i<n;++i){
while (top>1 && query(tmp[top-1],tmp[top],p[i])==-1) --top;
tmp[++top]=p[i];
}
tmp[++top]=1;
int lt=1;
while (lt+2<top){
if (query(tmp[top-1],tmp[top],tmp[lt])==-1) --top;
else if (query(tmp[top],tmp[lt],tmp[lt+1])==-1) ++lt;
else break;
}
vector<int> ans;
cout<<"! ";
for (int i=lt;i<=top;++i) cout<<tmp[i]<<" ";
cout<<endl;
//return ans;
}
//int main(){
//return 0;
//}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
input:
5 1 -1 -1 1 1 -1 1 1 1
output:
? 1 3 2 ? 1 3 4 ? 1 3 5 ? 1 4 5 ? 4 5 3 ? 5 3 2 ? 4 5 2 ? 2 1 4 ? 1 4 5 ! 4 5 2 1
result:
wrong answer format Unexpected end of file - int32 expected