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

25986번 - Guessing Primes 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 (추가 시간 없음) 2048 MB122131213.333%

문제

Your friends are all on board with the hype of a popular game, where you need to guess a five-letter word in six tries. Unfortunately, your language skills are not the greatest, so this game is not really your cup of tea. However, your mathematics skills greatly outmatch your friends', so you start playing a game called "Brave Alternative Primes Challenge" (Original at https://converged.yt/primel/.) instead. In order to show off your skills to your friends, you decide to write a program that will always beat the game.

In this game, you need to guess a secret prime number of five digits (i.e., between 10ドル^4$ and 10ドル^5$) in six turns. After guessing a prime number, you will receive a response consisting of five characters, each corresponding to a single digit in your guess:

  • "g" (green) means you guessed the corresponding digit correctly;
  • "y" (yellow) means that the digit is present in a position that is not yet green, but not at this position;
  • "w" (white) means that this digit is neither green nor yellow.

Note that the interactor colours at most one of your guessed digits per digit in the secret answer. If your guess includes more occurrences of a digit than the answer, only some of them will be green or yellow.

You win the game when the response is green for all five digits.

입력

출력

제한

인터랙션

This is an interactive problem. Your submission will be run against an interactor, which reads from the standard output of your submission and writes to the standard input of your submission. This interaction needs to follow a specific protocol:

The interactor first sends one line with an integer $n$ (1ドル \leq n \leq 1000$), the number of rounds.

Then, for each of the $n$ rounds, your program should make at most 6ドル$ guesses, each guess being a prime number of five digits (i.e., between 10ドル^4$ and 10ドル^5$). The interactor will respond with a string of characters in "wyg", as described above. A round ends when the response is "ggggg".

The interactor is not adaptive, i.e., the secret prime number is fixed during a round.

Make sure you flush the buffer after each write.

A testing tool is provided to help you develop your solution.

Using more than 6ドル$ queries in one round will result in a wrong answer.

예제 입력 1

2
ywyww
wwwyg
gggww
ggggg
wwwwy
wgwgw
ggggg

예제 출력 1

54323
98737
31583
31517
99991
44449
14143

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2022 Preliminaries G번

  • 문제를 만든 사람: Ludo Pulles

채점 및 기타 정보

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

출처

대학교 대회

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

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