Dice Encryption Algorithm
시간 제한3초메모리 제한2048 MB
10^100 이하의 수를 18500번의 주사위 굴림 과정으로 선택해 암호화하고, 기록을 이용해 원래 수를 복호화하는 인터랙티브 문제다.
문제
This is an interactive run-twice problem.
What is a game without a little gambling? But wait... we're serious people here, and gambling is not for us! Instead, let's dive into the world of encryption algorithms. However, to keep things intriguing, we will introduce a new encryption algorithm that uses randomness derived from rolling dice!
You will be given a number ranging from to . Your task is to encrypt this number through a series of dice rolls and then decrypt it to return to the original value.
The encryption process consists of exactly steps. At each step, you will be given three six-faced dice. The dice are fair: all faces have an equal probability of being selected. Each face of each die displays an integer from to selected uniformly at random, independently of the others. You will then select one of the three given dice. After that, the jury will roll your chosen die once, and record the outcome.
힌트
The example contains only steps. This is only to demonstrate the format of input and output. During system testing, there will be exactly steps.