#P6614. 蛋糕 Cake
蛋糕 Cake
Background
Those who do not share the same values cannot work together.
likes eating cake, especially chocolate cake.
gave her a super huge chocolate cake as a birthday present, with many chocolate puddings decorating the cake.
definitely cannot finish such a big cake by herself, so she wants to help her cut the cake into two pieces, such that the ratio of the number of puddings on the two pieces is .
The cake can be abstracted as a 2D plane; and the workshop that made the cake is rather careless, so each pudding is very small and can be regarded as an integer lattice point on the 2D plane.
has excellent knife skills, so he plans to show off. He will only make one cut along the graph of a linear function with slope not less than and not greater than .
He wants to test your intelligence: if it were you, how would you cut it?
Problem Description
Given and , find a linear function such that divides the points in the plane into two parts whose counts are in the ratio .
If you do not know why a linear function is written in this form, here is the definition of point-slope form.
Input Format
The first line contains three integers , representing the number of points and the ratio you want to split into.
The next lines each contain two integers , representing the point on the plane.
The testdata guarantees that no two points coincide.
Output Format
Output one line with three integers, representing in the statement.
You must ensure that .
If a point lies exactly on the line you give, we consider it to be above the line.
2 1 1
0 1
1 0
1 0 0
Hint
This problem uses bundled tests.
guaranteed .
guaranteed .
guaranteed , .
For all testdata, it is guaranteed that and .
Special Judge
This problem uses .
List of spj return messages:
Your answer is correct!: your result is correct.
Your answer is wrong, expected ratio as a : b, found A : B.: your function is incorrect; it splits all points into two parts with ratio instead of .
Oops, data out of range!: the coordinates or slope you provided are outside the required range.
Note that during the contest, you cannot see the return message from Special Judge.
Translated by ChatGPT 5