This is an answer-submission problem.
Background
A computer in the school's server room seems to have developed a problem: many files on its hard drive are corrupted and can no longer be read.
As a machine that has been in use for a long time, this kind of problem is quite common. However, considering that there might be valuable files among them, you decide to back up the usable parts of the hard drive.
Just then, you discover something extraordinary:
"AI: All-Purpose Edition"
You try opening it, and it actually runs. However, you have no idea how to interact with it.
Fortunately, this AI comes with interactive test cases, but the corresponding input files are also corrupted. The only things available are some output files.
"If only I could recover these input files, wouldn't that be perfect?" With this thought in mind, you decide to take on this seemingly difficult task yourself.
Description
Given an AI and some execution results, you need to write input data such that the AI produces these results.
The internal workings of the AI are beyond human understanding, so you can only interact with it through input and output.
The AI's functionality covers many aspects, so each function needs to be tested. Unfortunately, since the manual is lost, the specific details of these functions must be guessed by you.
Target Files and Input/Output
This is an answer-submission problem; you do not need to submit your source code.
There are 10 test cases in this problem, each with 4 target files. The target files are named X.taskY, where $X$ is the test case number and $Y$ is one of $1, 4, 7, 10$. For the first test case, the 4 files are: 1.task1, 1.task4, 1.task7, and 1.task10.
You need to write 10 files, named 1.out through 10.out, with each file corresponding to one test case.
Note: The terms "input file" and "output file" refer to the AI's perspective, not the problem's.
The AI is packaged as a program, represented by the executable file ai (usage instructions below). The AI takes X.out as input and writes to X.res. Your task is to make X.res identical to one of the X.taskY files. If successful, you receive $Y$ points for that test case; otherwise, you receive $0$ points.
The first line of the AI's input file is Type i, where $i$ is an integer indicating which function the subsequent task requires. The following lines contain the input content, the format of which varies depending on the function and is not explicitly defined.
The first line of the AI's output file is also Type i, where $i$ is the same as in the input file. The following lines contain the corresponding output content.
How to Use the AI
You need to use the ai executable provided in the additional files. There are several ways to call it. You may rename the files, but the following examples assume no changes.
First, you need to open a terminal and use the cd command to navigate to the appropriate directory.
- Enter the following in the terminal:
./ai
This runs the AI using standard input and output.
- You can add the
-sparameter to have the program read from input.txt and write to output.txt, for example:
./ai -s
- You can directly add the number $X$ to have the program read from X.out and write to X.res. For example:
./ai 7
This reads from 7.out and writes to 7.res.
Here, $X$ can be any non-negative integer, not limited to $1$ through $10$.
- You can add two parameters to have the program read from the first filename and write to the second. For example:
./ai a.out a.res
This reads from a.out and writes to a.res.
All relevant files for this problem, including the ai program, have been provided on your machine. If you re-download the problem directory from the OJ, you must run the following command before using the downloaded ai:
chmod +x ai
How to Test Your Results
We have provided a test program checker to verify your results.
Place the test program in the same directory as all .out files, all .taskY files, and the ai program to run it. The test program will execute ./ai 1 through ./ai 10, which will overwrite X.res. After that, it will display the score for each test case on the screen.
Examples
Example Target File 0.taskY
Type 45 你好 世界
Example Input File 0.out
Type 45 hello world
Note
The $45$th function of the AI is a simple dictionary that translates English words on each line into Chinese. If a word is not in the dictionary, it will be translated as [未收录]. All English words used by the AI are already included in the dictionary.
The target file contains the Chinese words 你好 and 世界, so the required input file consists of the corresponding English words hello and world.
Note
Please save the target files X.taskY and the files you write, X.out, and back them up regularly to prevent accidental deletion.
Scores obtained by manually modifying the target files are invalid.
To get the maximum score, you only need to write 10 files, not 40.