QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#535527#6345. Random Interactive Convex Hull BotWorld_CreaterWA 83ms3788kbC++141.0kb2024-08-28 09:17:062024-08-28 09:17:07

Judging History

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

  • [2024-08-28 09:17:07]
  • 评测
  • 测评结果:WA
  • 用时:83ms
  • 内存:3788kb
  • [2024-08-28 09:17:06]
  • 提交

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<<"! "<<top-lt+1<<" ";
for (int i=lt;i<=top;++i) cout<<tmp[i]<<" ";
cout<<endl;
//return ans;
}

//int main(){
//return 0;
//}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3600kb

input:

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

output:

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

result:

ok OK, 11 queries, 4 point in hull

Test #2:

score: 0
Accepted
time: 3ms
memory: 3668kb

input:

50
1
-1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
1
-1
1
1
-1
1
1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
-1
1
-1
1
-1
-1
-1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
1
1
-1
1
1
1
1
1
-1
1
1
1
1
1
-1
-1
1
-1
1
1
1
-1
-1
1
1
1
1
1
1
1
1
1
1
1
-1
-1
1
1
-1
-1
-1
1
1
1
1
1
-1
1
-1
1
-1
1
-1
1
1
1
1
1
1
1
1
1
-1
-1
-1
1
1
1
-1
-1
1
1
1
-1
1...

output:

? 1 30 2
? 1 30 3
? 1 30 4
? 1 30 5
? 1 30 6
? 1 30 7
? 1 30 8
? 1 30 9
? 1 30 10
? 1 30 11
? 1 30 12
? 1 30 13
? 1 30 14
? 1 30 15
? 1 30 16
? 1 30 17
? 1 30 18
? 1 30 19
? 1 30 20
? 1 30 21
? 1 30 22
? 1 30 23
? 1 30 24
? 1 30 25
? 1 30 26
? 1 30 27
? 1 30 28
? 1 30 29
? 1 30 31
? 1 30 32
? 1 30 3...

result:

ok OK, 308 queries, 10 point in hull

Test #3:

score: 0
Accepted
time: 17ms
memory: 3780kb

input:

1000
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
1
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
-1
-1
1
-1
1
1
-1
-1
1
-1
-1
1
-1
-1
1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
-1...

output:

? 1 741 2
? 1 741 3
? 1 741 4
? 1 741 5
? 1 741 6
? 1 741 7
? 1 741 8
? 1 741 9
? 1 741 10
? 1 741 11
? 1 741 12
? 1 741 13
? 1 741 14
? 1 741 15
? 1 741 16
? 1 741 17
? 1 741 18
? 1 741 19
? 1 741 20
? 1 741 21
? 1 741 22
? 1 741 23
? 1 741 24
? 1 741 25
? 1 741 26
? 1 741 27
? 1 741 28
? 1 741 29
...

result:

ok OK, 13233 queries, 21 point in hull

Test #4:

score: 0
Accepted
time: 20ms
memory: 3620kb

input:

2000
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
1
1
-1
-1
-1
-1
1
-1
1
-1
-1
-1
-1
-1
1
1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
1
-1
-1
-1
-1
-1
1
1
-1
1
1
-1
1
-1
-1
1
-1
-1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
-1
1
-1
1
1
-1
-1
-1
-1
1
-1
1
1
-1
1
1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
-1...

output:

? 1 1841 2
? 1 1841 3
? 1 1841 4
? 1 1841 5
? 1 1841 6
? 1 1841 7
? 1 1841 8
? 1 1841 9
? 1 1841 10
? 1 1841 11
? 1 1841 12
? 1 1841 13
? 1 1841 14
? 1 1841 15
? 1 1841 16
? 1 1841 17
? 1 1841 18
? 1 1841 19
? 1 1841 20
? 1 1841 21
? 1 1841 22
? 1 1841 23
? 1 1841 24
? 1 1841 25
? 1 1841 26
? 1 1841...

result:

ok OK, 28107 queries, 23 point in hull

Test #5:

score: -100
Wrong Answer
time: 83ms
memory: 3788kb

input:

3000
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
-1
-1
-1
-1
1
1
-1
1
-1
1
-1
-1
-1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
-1
-1
1
1
-1
-1
1
-1
1
-1
1
-1
-1
-1
-1
-1
1
-1
1
-1
-1
1
-1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
-1
1
-1
-1
-1
-1
-1
-1
-1
1
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

output:

? 1 1077 2
? 1 1077 3
? 1 1077 4
? 1 1077 5
? 1 1077 6
? 1 1077 7
? 1 1077 8
? 1 1077 9
? 1 1077 10
? 1 1077 11
? 1 1077 12
? 1 1077 13
? 1 1077 14
? 1 1077 15
? 1 1077 16
? 1 1077 17
? 1 1077 18
? 1 1077 19
? 1 1077 20
? 1 1077 21
? 1 1077 22
? 1 1077 23
? 1 1077 24
? 1 1077 25
? 1 1077 26
? 1 1077...

result:

wrong answer too many queries