P9165 "INOH" Round 1 - Accident.

Background

**This is a communication problem.** **For some reasons, this problem has special time and memory limits, and there are only three test points.** **Your final score is the minimum of the scores of the three test points.** **Please note that you should not submit with `C++14 (GCC 9)`.**

Description

Accidents in communication are unavoidable. Program A receives an array of length $10^2$ from the interactor, with each element in the range $ \lbrack 0, 998244353 ) $ . Program A encodes it, i.e., performs the `Encode` operation, producing an array of arbitrary length, with each element in the range $ \lbrack 0, 998244353 ) $, and then returns it to the interactor. The interactor will perform the following operation on the encoded array: - For each element, with a $50\%$ probability, it is assigned a random number in $ \lbrack 0, 998244353 ) $; with a $50\%$ probability, it remains unchanged. After that, Program B receives the modified array from the interactor. Program B needs to decode it, i.e., perform the `Decode` operation, and restore the original array that Program A initially received from the interactor. ## Implementation Details Since real communication cannot be implemented, this problem runs in an interactive manner. You do not need to, and should not, implement the main function. You only need to implement the following two functions. 1. `vector Encode ( vector vec );` - This function takes a `vector` of length $10^2$ and returns a `vector` of arbitrary length. 2. `vector Decode ( vector vec );` - This function takes a `vector` of arbitrary length and returns a `vector` of length $10^2$. **The interactor library will call `Encode` no more than $3 \times 10^4$ times, and call `Decode` no more than $1 \times 10^4$ times.** The provided interactor library is implemented as a fixed number of testdata groups: it randomly generates an array, and immediately applies `Encode` and `Decode`. It is only for simple checking of your program. When using it, you can **directly put your implemented `Encode` and `Decode` functions into the interactor library code**, then compile and run. If the interactor library outputs `Illegaled operation`, you will get $0$ points. Possible reasons include failing to restore the original array, or returning an illegal array. Otherwise, the interactor library will output an integer, which is your score. The judging interactor library may not call `Decode` immediately after `Encode`. That is, it may encode several arrays first, and then decode them one by one. All numbers must be in the range $ \lbrack 0, 998244353 ) $. ## Scoring Let the maximum length returned by your `Encode` be $Len$. Your score is $ \min( 100, \lfloor \frac{1500}{ \lceil \frac{Len}{50} \rceil } \rfloor ) $.

Input Format

None.

Output Format

None.

Explanation/Hint

Translated by ChatGPT 5