P3692 Xia Huan's Exam

Background

Xia Huan is a guru in the Software Engineering department, and the school has assigned her to organize an exam.

Description

A university's Software Engineering program is holding a written test. Students fill answers on a machine-readable answer sheet. The school assigned the recognition task to Xia Huan, but the system requirements are too complex and she also has other projects to work on, so she wants you to help implement part of the functionality. The paper has two parts: the header and single-choice questions. Xia Huan has already written the recognition program, so the header and answers will be provided directly as numeric information. You need to implement the following features: You need to process $T$ papers and check the following items in order. 1. Check whether the examinee ID is filled in correctly. Input format: One line: a 16-bit unsigned binary number id. The examinee's ID is id, and the correct ID range in decimal is $1 \sim 10000$. If the ID is invalid, output one line `Wrong ID` and stop processing this paper (you still need to read the remaining two parts' input for this paper, but do not output anything else). If the ID is valid, output one line: `ID: ` + an integer, which is the decimal form of the ID. You do not need to consider whether IDs are duplicated; as long as the value is within the range, it is considered valid. 2. Check whether the paper type is filled in correctly. Input format: One line: two digits with no separator, each must be $0$ or $1$. The first digit indicates whether paper type A is bubbled ($0$ means not bubbled, $1$ means bubbled), and the second digit indicates whether paper type B is bubbled. In fact, the paper type can be determined by the last bit of the binary ID: $0$ means type A, $1$ means type B. You only need to check whether the student filled it correctly. If the student filled the paper type correctly (bubbled, and only bubbled, the correct one), output one line `Type Correct`; otherwise, output one line `Type Incorrect`. Regardless of correctness, you must continue processing this paper. 3. Score the single-choice questions. The number of single-choice questions $n$ and the answer key will be provided before entering the first paper. Candidate answers input format: $n$ lines, each with 4 digits and no separator. Each digit is $0$ or $1$. In order, they represent whether $A, B, C, D$ are bubbled ($0$ means not bubbled, $1$ means bubbled). A student's answer to a question is correct if and only if the correct option is bubbled and all incorrect options are not bubbled. Output one line: a floating-point number rounded to 1 decimal place, representing the student's score. The full score is $100$, and each question has the same weight.

Input Format

The first line contains two integers $T$ and $n$, separated by a space, as described above. The next line contains a string $s$ of length $n$. Each character is one of the uppercase letters $A, B, C, D$, and the $i$-th character is the answer to single-choice question $i$. Then the next $T \times (n+2)$ lines contain $T$ groups of information, representing the content of each paper, with the format as described above.

Output Format

For each paper, output the judgment results as described. Insert one blank line between the results of two papers.

Explanation/Hint

For 100% of the testdata $1 \le T \le 1000$ $1 \le n \le 50$ Notes: 1. Please also add a newline after processing the last paper. 2. Due to differences in line endings between Windows and Linux, it is recommended not to use scanf to read char. Translated by ChatGPT 5