Hide

Problem B
Julmust

Languages da en
/problems/julmust/file/statement/en/img-0001.jpeg
An array of julmust bottles with a glass of julmust in front.
Maj loves the traditional Swedish Christmas soft drink called julmust. She likes it so much that she has convinced her local store to start selling it already on the 1st of October!

Maj is a creature of habit. She consumes exactly the same number of bottles of julmust every day from the 1st of October until Christmas Eve (the 24th of December). The number of bottles per day is a positive integer $r$, where $0 < r \leq R$.

You need to determine the total number of julmust bottles she has consumed so far. You need to be done at the end of Christmas Eve, $85$ days after she started drinking.

At the end of every day, you ask Maj how much julmust she had so far. You can only ask one question per day.

Interaction

The interaction starts by giving your program a single line of input with an integer $R$, the maximum number of bottles Maj could possibly consume per day. Interaction proceeds in round, with one round per day. In each round, your program asks if Maj has consumed $X$ bottles of julmust since the 1st of October up to and including the current day. The format of a question is “$X$” where $X$ is a non-negative integer. Thus, your first question “$X_1$” means “Have you consumed $X_1$ bottles on the 1st of October,” your second question “$X_2$” means “Have you consumed $X_2$ bottles in total on the 1st and 2nd of October,” and so on.

Maj’s response to each question can be read from standard input. Her response is a single line with one of the following three words:

  • “less” if Maj has consumed strictly fewer than $X$ bottles so far.

  • “exact” if Maj has consumed exactly $X$ bottles so far.

  • “more” if Maj has consumed strictly more than $X$ bottles so far.

When your program receives “exact” it has successfully completed the task and should exit, not asking any more questions.

Your program is judged wrong if you have not received an “exact” response after $85$ rounds.

Flushing

In interactive problems your program will be judged by a judge program. If your program does not flush the output stream when printing output the judge program might not receive your output in time and your program might be judged as Time Limit Exceeded. To avoid this, make sure to always flush your output after each time you print.

In Python3:

print(x, flush=True)

In Java:

System.out.println(x);
System.out.flush();

In C++:

std::cout << x << "\n" << std::flush;

Scoring

Group

Points

Limits

1

25

$R = 84$

2

20

$R = 1\, 500$

3

55

$R = 1\, 000\, 000$

Sample Description

In Sample Interaction 1, Maj consumes 5 bottles of julmust each day. On the first day you ask if she has consumed 8 bottles, but she has only consumed 5 so far. On the second day you ask if she has consumed 10 bottles, which is true and the interaction ends.

In Sample Interaction 2, Maj consumes 6 bottles of julmust each day. On the first day you ask if she has consumed 10 bottles, but she has only consumed 6 so far. On the second day you ask if she has consumed 10 bottles, but now she has consumed 12 bottles. On the third day you ask if she has consumed 18 bottles, which is true and the interaction ends.

Read Sample Interaction 1 Write
84
8
less
10
exact
Read Sample Interaction 2 Write
84
10
less
10
more
18
exact