Logo
(追記) (追記ここまで)

28191번 - Random Interactive Convex Hull Bot 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 1024 MB2714741.176%

문제

How do setters come up with problems? Sometimes they just take a couple of buzzwords and smash them together. But we are in 2023, so this totally can be outsourced to AI. Introducing our creation based on ChatGPT --- RICH B! And its first official problem:

Prompt: Random Interactive Convex Hull

Problem: A set of $n$ points is chosen uniformly at random among all sets of 2D points with positive integer coordinates up to 10ドル^9$ of size $n$ so that no three points lie on the same line. Your task is to find their convex hull. But you are not given the points. Instead, you can make queries of the form "? $i$ $j$ $k$", and the jury program will respond to you with 1ドル$ if the turn from $\overrightarrow{P_i P_j}$ to $\overrightarrow{P_i P_k}$ is counter-clockwise, and it will respond with $-1$ if the turn is clockwise. You can interpret it as $\mathbf{sgn} \left( \overrightarrow{P_i P_j} \times \overrightarrow{P_i P_k} \right),ドル where $\times$ is cross product. When you think that you know the convex hull, print it as "! $k$ $i_1$ $i_2$ $\ldots$ $i_k$", where $k$ is the size of the convex hull and $i_1, i_2, \ldots, i_k$ are the indices of points on the convex hull in counter-clockwise order. Any point can be the first one. Constraints: 3ドル \le n \le 5000$ and you can make at most 30ドル,000円$ queries.

입력

출력

제한

인터랙션 프로토콜

Read $n$ (3ドル \le n \le 5000$).

Then start asking queries by printing "? $i$ $j$ $k$" (1ドル \le i, j, k \le n,ドル $\{i, j, k\}$ are distinct). After each query read the response, which is either 1ドル$ or $-1$. You can make at most 30ドル,000円$ queries.

Don't forget to flush the output, you are not a baby, you know how to do this. Don't do invalid queries, that might cause weird verdicts and you don't want that.

After making all the queries you want, print the answer as "! $k$ $i_1$ $i_2$ $\ldots$ $i_k$", where $k$ is the size of the convex hull and $i_1, i_2, \ldots, i_k$ are the indices of points on the convex hull in counter-clockwise order. This is not counted as a query.

It is guaranteed that the set of points is chosen uniformly at random among all sets of 2D points with positive integer coordinates up to 10ドル^9$ of size $n$ such that no three points lie on the same line. The order of the points is also uniformly random. The interactor is not adaptive.

예제 입력 1

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

예제 출력 1

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

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2023 > Day 6: Um_nik mod 998 244 353 Contest B번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /