|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||0||0||0||0.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 "
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.
- - ! good