| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 512 MB | 8 | 7 | 7 | 100.000% |
This problem was supposed to have a nice long legend about the Wild Wild West, but the author did not manage to write it in time, so use the power of your imagination!
Consider a number line. A player initially stands at the position $x = p$. At the beginning of each round, you can say either "+" or "-". After that, the player changes position according to what you said. More precisely, if you say $t$ and the player stood at position $x,ドル then he moves to position $x' = x + d_t,ドル where $d_+$ and $d_-$ are two integer constants.
You do not know the exact values $p,ドル $d_0$ and $d_1,ドル but you know that the player is either the Good, the Bad or the Ugly (yeah, imagination!):
As you can see, the starting position of the player depends on some integer constant $m$ (1ドル \le m \le 1000$)... unfortunately, you do not know it too.
After each round, the player tells you if he now stands at $x = 0$ or not.
It appears that, by playing several rounds, you can uniquely determine if the player is Good, Bad or Ugly. Do it in no more than 30ドル m$ rounds.
In each test, the values $m,ドル $p,ドル $d_+$ and $d_-$ are chosen according to the above rules. They are fixed in advance and don't change during the checking process.
This is an interactive problem.
If you want to play a round, print either "+" or "-" on a separate line. In response, you will get a line containing either 1ドル$ if the player arrived at position $x = 0,ドル or 0ドル$ if the player stands somewhere else.
If you are ready to guess the type of the player, print a line containing the character "!", a space and one of the words "good", "bad" or "ugly". After that, your program must terminate.
If after playing 30ドル m$ rounds you do not provide the answer, your solution will get a "Wrong Answer" outcome.
To prevent output buffering, flush the output buffer after each printed line.
0 1
- - ! good