#P6440. [COCI 2011/2012 #6] REZ【征集SPJ】
[COCI 2011/2012 #6] REZ【征集SPJ】
Description
There is a rectangular cake made of blueberries, strawberries, and chocolate. Its shape is like a square: the bottom-left corner is at and the top-right corner is at (the unit of the coordinate system is millimeters). Its area is square meters.
Professionals strongly recommend eating this cake with a wet knife and a dry spoon. Also:
- The starting point of each cut is on the boundary of the cake.
- A single cut cannot lie entirely on the boundary of the cake.
- No two cuts have the same start point and end point; that is, all cutting segments are different.
You may separate and count the pieces only after the last cut is made. In other words, during the cutting process, the cake always remains a rectangle.
Find the minimum number of cuts needed to cut the cake into at least pieces, and output the coordinates of the start and end points of each cut.
Input Format
One line with one integer , meaning the cake must be cut into at least pieces.
Output Format
The first line contains one integer , the minimum number of cuts.
The next lines each contain four integers: the coordinates of the start point and the end point of this cut.
For every point on the boundary of the cake, it is guaranteed that .
1
0
4
2
-5000 -5000 5000 5000
5000 -5000 -5000 5000
7
3
-5000 5000 0 -5000
-2000 -5000 5000 5000
-5000 0 5000 0
Hint
Constraints
For of the testdata, it is guaranteed that .
Notes
This problem is translated from COCI2011-2012 CONTEST #6 T4 REZ.
Translated by ChatGPT 5
京公网安备 11011102002149号