| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 (추가 시간 없음) | 1024 MB | 123 | 82 | 79 | 68.103% |
Donghyun recently bought a square-shaped tablecloth. There are $N$ dots on the cloth, and the dots can be seen from both sides of the cloth. Donghyun thought that the tablecloth can be made more beautiful, so he decided to decorate the cloth with sewing.
For convenience, let's assume that each dot is a point on the $xy$-plane and the dots are numbered from 1ドル$ to $N$. Dot $i$ (1ドル \le i \le N$) is placed at coordinate $(x_i, y_i)$. No two dots have the same coordinates. A sewing sequence is an integer sequence $\{ s_i \}$ of length $k \geq 2$ satisfying 1ドル \le s_i \le N$ (1ドル \le i \le k$) and $s_i \neq s_{i+1}$ (1ドル \le i \le k-1$).
The sequence draws edges on the cloth per the following rules:
Donghyun wants to make a \textbf{beautiful pattern} on the tablecloth, which is defined as the following:
Donghyun is very busy, so he wants to finish his sewing job as quickly as possible. In other words, over all sewing sequences that produces a beautiful pattern, Donghyun decides to choose the shortest such sequence. Your job is to find such a sequence.
Note that Donghyun wants to minimize the length of the sewing sequence itself, not the sum of the lengths of the edges he draws.
On the first line, a single integer $N$ is given. (2ドル \le N \le 1,000円$)
For each of the next $N$ lines, two integers $x_i$ and $y_i$ are given, which means dot $i$ is placed at coordinate $(x_i, y_i)$. (1ドル \le x_i, y_i \le 10^9$)
No two dots are at the same coordinates.
On the first line, output a positive integer $k,ドル the length of the shortest sewing sequence that produces a beautiful pattern.
On the next line, output $s_1,ドル $s_2,ドル $\cdots,ドル $s_k,ドル the actual sewing sequence.
It can be proven that, for every possible input, there exists a sewing sequence that produces a beautiful pattern.
5 1 1 2 4 3 2 4 5 5 3
9 1 2 4 3 2 3 5 3 1
Figure 1. Visualization of sample output. Solid lines represent for edges on front side, dashed lines represent for back side.
University > KAIST > KAIST ICPC Mock Competition > 2020 KAIST 10th ICPC Mock Competition J번
Contest > Open Cup > 2020/2021 Season > Stage 3: Grand Prix of Korea K번