## Yet Another Contest 6 P3 - No More Cell Phone Messaging

View as PDF

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Recently, Josh and Mike have been chatting too much on cell phones instead of studying! Their parents are upset and wish to end this chatting immediately.

So that they are not disturbed by their parents, Josh and Mike are in hiding places! Josh is located at position , whilst Mike is located at position . It is known that , , and are all integers. Furthermore, Josh is not at the same position as Mike, i.e., .

Their parents have a method to find Josh and Mike. They can stand at any position , where , , and are both integers. Then, based on the loudness of Josh and Mike's voices at that position, they can determine the minimum of the Manhattan distances to Josh and Mike. In other words, they can figure out the value of .

Can you help the parents find Josh and Mike by standing in no more than positions?

#### Interaction

This is an interactive problem, where the interactor is not adaptive.

First, you should read in the values of and , which are space-separated on a single line.

Then, you should begin making queries. To make a query, output a line in the form ? X Y, representing the position where the parents will stand. You should then read in an integer on the following line, which will be equal to .

Finally, once you have made all of your queries, you should output a line in the form ! A B C D, representing your guesses of Josh and Mike's coordinates. Note that the order in which the two positions are outputted does not matter, that is, you may output Josh's and Mike's coordinates in either order.

If at any point you make an invalid query, or make more than queries, the interactor will respond with -1 on the following line. Upon reading this value, you should terminate your program to receive a Wrong Answer verdict. Otherwise, you may receive an arbitrary verdict.

Please note that you may need to flush stdout after each operation, or interaction may halt. In C++, this can be done with fflush(stdout) or cout << flush (depending on whether you use printf or cout). In Java, this can be done with System.out.flush(). In Python, you can use sys.stdout.flush().

#### Sample Interaction

>>> denotes your output. Do not print this out.

2 3
>>> ? 1 1
2
>>> ? 2 1
2
>>> ! 1 3 2 3

#### Explanation

Josh is at position and Mike is at position .

When the parents stand at , they figure out that .

When the parents stand at , they figure out that .

The parents have enough information to determine that Josh is at position and Mike is at position , or vice versa. Note that ! 2 3 1 3 would also be a correct output, since the order in which Josh and Mike's coordinates are outputted does not matter.