CF1715F.Crop Squares

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

This is an interactive problem.

Farmer Stanley grows corn on a rectangular field of size $ n \times m $ meters with corners in points (0,0)(0, 0) , (0,m)(0, m) , (n,0)(n, 0) , (n,m)(n, m) . 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 1×11 \times 1 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 55 times.

More formally, it is allowed to make no more than 55 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 xx and yy coordinates).

输入格式

First line contains two integers nn and mm ( 1n,m1001 \le n, m \le 100 ) — field sizes.

输出格式

In order to query the area of intersection of a polygon with kk ( 3k10003 \le k \le 1000 ) vertices at points with coordinates (x1,y1),  ,  (xk,yk)(x_1, y_1),\; \dots ,\;(x_k, y_k) with a square of poisoned corn print k+1k+1 lines. In the first of these lines print "? k". In the ii -th of the next kk lines print two real numbers xix_i and yiy_i ( xi,yi104|x_i|, |y_i| \le 10^4 ) with at most 1515 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 ss ( 0s10 \le s \le 1 ) with 1515 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 xx and yy are real numbers with at most 1515 digits after decimal place representing the coordinates of its lower-left corner ( 0xn10 \le x \le n - 1 , 0ym10 \le y \le m - 1 ), 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 10610^{-6} . Formally let your answer be aa , jury answer be bb . Your answer will be considered correct if abmax(1,b)106\frac{|a-b|}{max(1,|b|)} \le 10^{-6} .

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 nn and mm ( 1n,m1001 \le n,m \le 100 ) — field sizes.

The second line should contain two real numbers xx ( 0xn10 \le x \le n - 1 ) and yy ( 0ym10 \le y \le m - 1 ) — coordinates of the lower-left corner of the square of poisoned corn.

输入输出样例

  • 输入#1

    3 3
    
    
    
    
    
    0.5
    
    
    
    
    
    0.5

    输出#1

    ? 4
    0 0
    2 0
    2 3
    0 3
    
    ? 4
    0 0
    0 1
    3 1
    3 0
    
    ! 1.5 0.5

说明/提示

In the first test from the statement, the aliens poisoned a square of corn with vertices at points with coordinates (1.5,0.5)(1.5, 0.5) , (1.5,1.5)(1.5, 1.5) , (2.5,1.5)(2.5, 1.5) , (2.5,0.5)(2.5, 0.5) . In the picture, it is red, the polygon selected in the query is blue, and their intersection is green.

Picture for the first query:

Picture for the second query:

首页