QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#535788#6345. Random Interactive Convex Hull BotTx_LcyWA 1ms3680kbC++141.1kb2024-08-28 14:47:472024-08-28 14:47:47

Judging History

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

  • [2024-08-28 14:47:47]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3680kb
  • [2024-08-28 14:47:47]
  • 提交

answer

//A tree without skin will surely die.
//A man without face will be alive.
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i=j;i<=k;++i)
#define per(i,j,k) for(int i=j;i>=k;--i)
mt19937_64 rnd(time(0));
int const N=5e3+10;
int n,id[N],s[N];
inline int query(int A,int B,int C){
    cout<<"? "<<A<<' '<<B<<' '<<C<<endl;
    int x;cin>>x;
    return x;
}
signed main(){
    cin>>n;
    deque<int>V;
    if (query(1,2,3)==1) V.emplace_back(1),V.emplace_back(2),V.emplace_back(3);
    else V.emplace_back(1),V.emplace_back(3),V.emplace_back(2);
    rep(i,4,n){
        int l=0,r=V.size()-1;
        while (l<r){
            int mid=(l+r+1)>>1;
            if (query(V[0],V[mid],i)==1) l=mid;
            else r=mid-1;
        }
        if (l<V.size()-1 && query(V[l],V[l+1],i)==1) continue;
        rotate(V.begin(),V.begin()+l+1,V.end());
        while (query(V[0],V[1],i)==-1) V.pop_front();
        while (query(V[V.size()-2],V[V.size()-1],i)==-1) V.pop_back();
        V.push_back(i);
    }
    cout<<"! ";
    for (auto i:V) cout<<i<<' ';
    cout<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

wrong answer incorrect hull, 10 queries