Editorial for COCI '11 Contest 6 #4 Rez
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
The first thing to notice is that, in order to obtain as many parts as possible, no three cuts will intersect in a common point. This is easy to see: if there is an intersection of three cuts, then we will get an extra part by moving slightly one of those cuts.
Now we can find a maximum number of parts as a function of number of used cuts:
So we must find the minimum for which . Since our function is obviously monotonic, we can use binary search to find the minimum .
If we output only the expected , we get of the total number of points.
There are many ways to find the actual cuts, and here is the simplest one. Make the cut by connecting these two points: and
Comments