Logo
(追記) (追記ここまで)

18523번 - The Good, the Bad and the Ugly 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB877100.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!):

  • The Good player has $p = m,ドル $d_+ = 2,ドル $d_- = -1$;
  • The Bad player has $p = -m,ドル $d_+ = 1,ドル $d_- = -2$;
  • The Ugly player has either $p = m$ or $p = -m$ and either $d_+ = 1$ and $d_- = -1$ or $d_+ = -1$ and $d_- = 1$.

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.

예제 입력 1

0
1

예제 출력 1

-
-
! good

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2019 > Day 4: Yandex Cup J번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /