#P6741. [BalticOI 2014] Demarcation (Day2)
[BalticOI 2014] Demarcation (Day2)
Description
Given a polygon, find a line segment that divides this polygon into two congruent polygons.
You must ensure that this line segment is parallel to the coordinate axes.
Input Format
The first line contains an integer , meaning that the polygon consists of points.
The next lines each contain two integers , representing a vertex of the polygon .
Output Format
If it is impossible to divide it into two congruent polygons, output the string NO.
If it is possible, output four integers , representing the segment .
10
0 0
1 0
1 1
3 1
3 5
2 5
2 3
1 3
1 2
0 2
1 2 3 2
Hint
Sample Explanation
For sample , as shown in the figure below, it can be divided into two congruent polygons:

Similarly, outputting 3 2 1 2 is also acceptable.
For sample , as shown in the figure below, it cannot be divided into two congruent polygons:

Constraints and Notes
This problem uses bundled testdata.
- Subtask 1 (12 pts): A solution is guaranteed to exist.
- Subtask 2 (15 pts): .
- Subtask 3 (23 pts): .
- Subtask 4 (50 pts): No special restrictions.
For of the testdata, .
This problem uses Special Judge.
Note
Translated from BalticOI 2014 Day2 A Demarcation。
Translated by ChatGPT 5
京公网安备 11011102002149号