Number Guessing Game
Time limit3sMemory limit512 MB
For each N from 1 to M, find the first questions student 1 can ask to maximize their own winning chance, given K students playing the guessing game.
- Level
Medium7 of 10
- Topics
- Game theory, Dynamic programming, Probability
- Solved
- No attempts yet
Problem
students play a game to guess a number the teacher picks.
- The teacher picks a random integer from 1 to inclusive. The students know in advance.
- Starting with student 1 and going one at a time, each student picks a number from 1 to and asks about it. If , that student wins. Otherwise, the teacher reveals to all students whether is less than or greater than .
- After student asks, the turn returns to student 1. The game continues until some student guesses .
Each student asks the question that maximizes their own probability of winning. If several such questions exist, the student picks one of them uniformly at random. All students know that everyone uses this strategy.
Your goal is to find the candidates for the first question student 1 can ask on the first turn.
Given a positive integer and the number of students , write a program that, for each , finds the candidates for student 1's first question.
Input
The first line contains a positive integer ().
The second line contains the number of students ().
Output
Print lines. On line , for , let be the candidate answers for student 1's first question in ascending order. Print numbers separated by spaces in the form .