QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#99775#6345. Random Interactive Convex Hull BottricyzhkxWA 121ms3800kbC++141016b2023-04-23 17:58:122023-04-23 17:58:15

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-23 17:58:15]
  • 评测
  • 测评结果:WA
  • 用时:121ms
  • 内存:3800kb
  • [2023-04-23 17:58:12]
  • 提交

answer

# include <bits/stdc++.h>
using namespace std;
int que[5010];
vector<int> conv;
bool query(int i,int j,int k)
{
	printf("? %d %d %d\n",i,j,k);fflush(stdout);
	int ans;scanf("%d",&ans);
	return ans>0;
}
int main()
{
	int n;
	cin>>n;
	if(query(1,2,3)) conv={1,2,3};
	else conv={1,3,2};
	for(int i=4;i<=n;i++)
	{
		int sz=conv.size(),le=0,ri=0;
		if(query(conv[0],i,conv[1]))
		{
			for(int j=1;j<sz;j++) que[ri++]=conv[j];
			que[ri++]=conv[0];
		}
		else
		{
			int l=1,r=sz-1,mid;
			while(l<r)
			{
				mid=(l+r+1)/2;
				if(query(conv[0],conv[mid],i)) l=mid;
				else r=mid-1;
			}
			if(l<sz-1 && query(i,conv[l],conv[l+1])) continue;
			for(int j=l+1;j<sz;j++) que[ri++]=conv[j];
			for(int j=0;j<=l;j++) que[ri++]=conv[j];
		}
		while(le+1<ri && query(que[ri-2],i,que[ri-1])) ri--;
		while(le+1<ri && query(que[le+1],que[le],i)) le++;
		que[ri++]=i;
		conv=vector<int>(que+le,que+ri);
	}
	cout<<"! "<<conv.size();
	for(int i:conv) cout<<" "<<i;
	return puts(""),0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3800kb

input:

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

output:

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

result:

ok OK, 9 queries, 4 point in hull

Test #2:

score: 0
Accepted
time: 2ms
memory: 3564kb

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...

output:

? 1 2 3
? 1 4 3
? 1 2 4
? 3 4 2
? 3 1 4
? 1 5 3
? 1 2 5
? 5 3 2
? 1 5 3
? 4 2 5
? 2 6 4
? 2 3 6
? 2 5 6
? 3 6 5
? 4 2 6
? 2 7 4
? 2 3 7
? 2 1 7
? 7 1 3
? 4 7 1
? 5 3 7
? 3 8 5
? 7 8 3
? 6 5 8
? 2 6 8
? 6 9 2
? 6 7 9
? 6 4 9
? 9 2 4
? 6 9 2
? 1 4 9
? 4 10 1
? 4 8 10
? 4 7 10
? 4 3 10
? 10 3 8
? 4 11 ...

result:

ok OK, 260 queries, 10 point in hull

Test #3:

score: 0
Accepted
time: 39ms
memory: 3556kb

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
1
1
-1
-1
-1
-1
1
-1
1
...

output:

? 1 2 3
? 1 4 3
? 1 2 4
? 3 4 2
? 3 1 4
? 1 5 3
? 1 2 5
? 1 4 5
? 2 5 4
? 3 5 2
? 3 1 5
? 1 6 3
? 1 2 6
? 1 5 6
? 2 6 5
? 3 6 2
? 3 1 6
? 1 7 3
? 1 2 7
? 1 6 7
? 7 2 6
? 3 7 2
? 1 6 7
? 6 8 1
? 6 2 8
? 6 7 8
? 8 2 7
? 6 9 1
? 6 2 9
? 6 7 9
? 2 9 7
? 3 9 2
? 1 6 9
? 6 10 1
? 6 2 10
? 6 9 10
? 10 2 9
...

result:

ok OK, 5981 queries, 21 point in hull

Test #4:

score: 0
Accepted
time: 53ms
memory: 3564kb

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
1
1
-1...

output:

? 1 2 3
? 1 4 3
? 1 2 4
? 4 3 2
? 1 4 3
? 1 2 4
? 2 5 1
? 2 3 5
? 2 4 5
? 5 3 4
? 1 5 3
? 2 4 5
? 4 6 2
? 4 3 6
? 4 1 6
? 6 1 3
? 2 6 1
? 5 3 6
? 3 7 5
? 3 2 7
? 3 4 7
? 7 5 4
? 3 7 5
? 2 4 7
? 1 2 7
? 2 8 1
? 2 3 8
? 2 6 8
? 8 6 3
? 2 9 1
? 2 3 9
? 2 5 9
? 2 7 9
? 9 5 7
? 2 10 1
? 2 3 10
? 2 5 10
?...

result:

ok OK, 12557 queries, 23 point in hull

Test #5:

score: 0
Accepted
time: 70ms
memory: 3796kb

input:

3000
1
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4
? 1 2 6
? 6 4 2
? 1 7 4
? 1 2 7
? 7 4 2
? 1 8 4
? 1 2 8
? 1 5 8
? 8 2 5
? 1 9 4
? 1 2 9
? 1 5 9
? 9 2 5
? 1 10 4
? 1 2 10
? 1 5 10
? 10 2 5
? 4 10 2
? 1 5 10
? 5 11 1
? 5 2 11
? 5 10 11
? 11 2 10
? 4 11 2
? 1 11 4
? 5 10 11
? 10...

result:

ok OK, 25429 queries, 22 point in hull

Test #7:

score: -100
Wrong Answer
time: 104ms
memory: 3548kb

input:

4999
-1
1
-1
-1
-1
1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
-1
1
-1
1
-1
1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
-1
1
1
1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
1
1
1
-1
-1
1
1
-1
1
-1
1
1
-1
-1
-1
-1
1
1
-1
-1
-1
1
-1
1
1
-1
-1
1
-1
-1
-1
1
-1
-1
-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 2 3
? 1 4 3
? 2 4 1
? 2 3 4
? 3 5 2
? 3 1 5
? 3 4 5
? 1 5 4
? 2 5 1
? 2 3 5
? 3 6 2
? 3 1 6
? 3 5 6
? 6 1 5
? 2 6 1
? 3 5 6
? 5 7 3
? 5 1 7
? 5 2 7
? 7 3 2
? 5 8 3
? 5 1 8
? 5 6 8
? 8 1 6
? 5 9 3
? 5 1 9
? 5 2 9
? 9 2 1
? 3 9 2
? 6 1 9
? 5 6 9
? 6 10 5
? 6 2 10
? 6 9 10
? 2 10 9
? 5 6 10
? 6 11 ...

result:

wrong answer too many queries