#P15054. [UOI 2023 II Stage] Square or rectangle

    ID: 16984 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>2023交互题Special JudgeUOI(乌克兰)

[UOI 2023 II Stage] Square or rectangle

题目描述

Eolymp offers you to play an interesting interactive game "Square or Rectangle" with the testing system.

Eolymp has a square board of size 100×100100 \times 100 cells. The lines of the board are numbered by integers from 11 to 100100 from top to bottom, and the columns are numbered by integers from 11 to 100100 from left to right. Accordingly, the cell that is located in the upper left corner of the board has coordinates (1,1)(1,\,1); the cell that is located in the lower right corner has coordinates (100,100)(100,\,100); and the cell that is located at the intersection of the ii-th row and jj-th column has coordinates (i,j)(i,\,j).

Eolymp paints a rectangular area of the board, the upper left corner of which has coordinates (x1,y1)(x_1,\,y_1), and the lower right --- (x2,y2)(x_2,\,y_2). Eolymp keeps these coordinates secret. But it is known that the area of the painted area is at least 4%4\% of the area of the entire board.

You can ask Eolymp about any cell (whether it belongs to the painted area) and get an honest answer from the testing system. You need to find out if the painted area is a square.

:::align{center} :::

Interaction

To find out if a cell belongs to the painted area, you need to ask Eolymp about it. To do this, you need to output the character "?", and two integers xx and yy (1x100,  1y100)(1 \le x \le 100, \; 1 \le y \le 100) --- the coordinates of the point you want to ask about. After this, you need to output the character new line and perform the operation flush\tt{flush}. After this, you need to read a line. Eolymp will output either inside\tt{inside} if the cell is painted, or outside\tt{outside} otherwise.

  • fflush(stdout)\tt{fflush(stdout)} or cout.flush()\tt{cout.flush()} in C++;
  • System.out.flush()\tt{System.out.flush()} in Java;
  • flush(output)\tt{flush(output)} in Pascal;
  • stdout.flush()\tt{stdout.flush()} in Python;
  • for all other languages you need to look at the documentation yourself.

You can ask no more than 1000010\,000 questions.

When you know the answer, you need to output the character "!", a space, and one of the two variants: either square\tt{square} (if the figure painted by Eolimp is a square), or rectangle\tt{rectangle} (if the figure is a rectangle).

If you do not follow the format of interaction, you can receive any verdict: Wrong Answer\tt{Wrong\ Answer}, Runtime Error\tt{Runtime\ Error}, Time Limit Exceeded\tt{Time\ Limit\ Exceeded}, etc.

inside
inside
outside
inside
outside
outside
inside
outside
outside
? 50 50
? 75 75
? 10 10
? 20 20
? 19 20
? 20 19
? 80 80
? 81 80
? 80 81
! square
10 10 80 80
32

提示

In the example, Eolymp painted an area whose upper left corner is (20,20)(20, 20), and the lower right corner is (80,80)(80, 80).

The condition provides an example of how to interact with Eolymp. Your queries to Eolymp may be different.

Your program will play this game with Eolymp many times. Let qq be the maximum number of questions you asked in all the games. Then you will receive such amount of points:

  • If you asked more than 1000010\,000 questions in any game, gave a wrong answer, or did not follow the format of interaction, you will receive 00 points.
  • If 1000<q100001\,000 < q \leq 10\,000, you will receive 55 points.
  • If 100<q1000100 < q \leq 1\,000, you will receive 1919 points.
  • If 50<q10050 < q \leq 100, you will receive 20+(100q)305020 + \lfloor\frac{(100 - q) \cdot 30}{50}\rfloor points.
  • If 33<q5033 < q \leq 50, you will receive 50+(50q)501750 + \lfloor\frac{(50 - q) \cdot 50}{17}\rfloor points.
  • If q33q \leq 33, you will receive 100100 points.