| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 77 | 38 | 30 | 50.000% |
You are typing your password at a sudo prompt, but suddenly, one of your fingers slipped onto a wrong key. Because the terminal hides the characters that you type, you are uncertain whether you have typed an extra character. To finish typing your password, you consider three possible strategies.
To determine the optimal strategy, make use of the following typing speed assumptions.
You are given the number of characters in your password $n,ドル the number of correctly typed characters $k$ before your finger slipped, and a probability of $p\%$ indicating the likelihood that you pressed a wrong key and ended up with $k+1$ characters. Assuming you make no further errors, determine which strategy yields the lowest expected time to finish typing your password.
The input consists of:
Output one of the strings "continue", "backspace", or "restart" indicating the optimal strategy. It is guaranteed that the expected time of the optimal strategy is at least one millisecond shorter than the other strategies.
10 8 20
continue
10 8 80
backspace
10 2 50
restart
10 4 55
restart
ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2024 Preliminaries E번