Programming contests

ECN programozó csapatverseny, 2023. november 25.

November 25, 2023, 10:30 AM – November 25, 2023, 3:30 PM

Breaking a Quantum Cryptography Machine

During the Third Interstellar War, the Secret Service tasked you with cracking the enemy's quantum cryptography machine that protects the enemy's communications. The last captured cryptographic messages consist of instructions intercepted by the Secret Service and their corresponding solutions. The correctness of the messages have been verified by the Secret Service. Find out the operating principle of the quantum machine using the messages broken so far, and reimplement it using C/C++.

Captured Instructions #1

  1. TITKOS_P 3
  2. TITKOS_P 13
  3. TITKOS_A
  4. TITKOS_P 5
  5. TITKOS_S
  6. TITKOS_E
download as text file

Solution #1

  1. -11
download as text file

Captured Instructions #2

  1. TITKOS_P 2
  2. TITKOS_P 8
  3. TITKOS_P 23
  4. TITKOS_S
  5. TITKOS_A
  6. TITKOS_E
download as text file

Solution #2

  1. 17
download as text file

Captured Instructions #3

  1. TITKOS_P 2
  2. TITKOS_P 8
  3. TITKOS_P 23
  4. TITKOS_A
  5. TITKOS_S
  6. TITKOS_E
download as text file

Solution #3

  1. 29
download as text file

Input Specification

The input contains a sequence of similar instructions to those in the captured messages, one instruction per line. The input may be considered correct in all cases. There are no conflicting instructions or instructions that cannot be executed at any point in time. All intermediary numbers as well as the results are integers that fit into the range of the int type.

Output Specification

Print one line to the standard output, containing the solution of the sequence of instructions read from the input.

University of Debrecen; Faculty of Informatics; v. 09/30/2024