[Solution] Crop Squares Codeforces Solution
This is an interactive problem.
Farmer Stanley grows corn on a rectangular field of size meters with corners in points , , , . This year the harvest was plentiful and corn covered the whole field.
The night before harvest aliens arrived and poisoned the corn in a single square with sides parallel to field borders. The corn inside the square must not be eaten, but you cannot distinguish it from ordinary corn by sight. Stanley can only collect a sample of corn from an arbitrary polygon and bring it to the laboratory, where it will be analyzed and Stanley will be told the amount of corn in the sample that was poisoned. Since the harvest will soon deteriorate, such a study can be carried out no more than times.
More formally, it is allowed to make no more than queries, each of them calculates the area of intersection of a chosen polygon with a square of poisoned corn. It is necessary to find out the coordinates of the lower-left corner of the drawn square (the vertex of the square with the smallest and coordinates).
First line contains two integers and () — field sizes.
In order to query the area of intersection of a polygon with () vertices at points with coordinates with a square of poisoned corn print lines. In the first of these
lines print "? k". In the -th of the next lines print two real numbers and () with at most digits after decimal place.
The polygon must have strictly positive area and contain no self-intersections.
In response to this query you will receive a real number () with digits after decimal place — the area of intersection of the square with the given polygon. If the polygon is invalid, there is no guarantee on the valid response.
When you have identified the drawn square, print on a separate line "! x y", where and are real numbers with at most digits after decimal place representing the coordinates of its lower-left corner (, ), and then you have to terminate your program.
Your answer will be considered correct if its absolute or relative error on both coordinates does not exceed . Formally let your answer be , jury answer be . Your answer will be considered correct if .
After printing a query do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:
- fflush(stdout) or cout.flush() in C++;
- System.out.flush() in Java;
- flush(output) in Pascal;
- stdout.flush() in Python;
- see documentation for other languages.
Hacks
To make a hack, use the following test format.
The first line of the input should contain two integers and () — field sizes.
The second line should contain two real numbers () and () — coordinates of the lower-left corner of the square of poisoned corn.
No comments:
Post a Comment