AlgoLensArena
ContestlərProblemlərOtaqlar
Vizualizator
← Məsələlər

DAPC24-067.Expected Error

Medium · 1 s · 256 MB

  • icpc
  • dapc
  • 2024

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.

1. Continue to type the rest of your password.
2. Press backspace to delete the last character and type the rest of your password.
3. Restart typing your password from scratch.

To determine the optimal strategy, make use of the following typing speed assumptions.

• Typing any character of your password takes 0.10.10.1 seconds.

• Pressing backspace or submitting your password also takes 0.10.10.1 seconds.

• To restart typing your password, you delete all characters, which takes 0.30.30.3 seconds.

• If you submit the wrong password, it takes an additional 0.30.30.3 seconds to realize and start typing your password at a new, empty prompt.

You are given the number of characters in your password nnn, the number of correctly typed characters kkk before your finger slipped, and a probability of p%p\%p% indicating the likelihood that you pressed a wrong key and ended up with k+1k+1k+1 characters. Assuming you make no further errors, determine which strategy yields the lowest expected time to finish typing your password.

Giriş formatı

The input consists of:

• One line with three integers nnn, kkk, and ppp (1≤n≤10001\leq n\leq10001≤n≤1000, 1≤k≤n1\leq k\leq n1≤k≤n, 0≤p≤1000\leq p\leq1000≤p≤100), the number of characters in your password, the number of characters you correctly typed before your finger slipped, and the probability percentage that you pressed a wrong key.

Çıxış formatı

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.

Qeyd

Source: Delft Algorithm Programming Contest 2024 · Author: Mike de Vries · License: CC BY-SA 4.0 · Original: https://dapc.wisv.ch · Statement adapted for AlgoLens and shared under the same license. · 8 of the 128 original test cases (the largest) are omitted here to keep the problem lightweight.

Nümunələr

Giriş #1

10 8 20

Çıxış #1

continue

Giriş #2

10 8 80

Çıxış #2

backspace

Giriş #3

10 2 50

Çıxış #3

restart

Giriş #4

10 4 55

Çıxış #4

restart