QOJ.ac

QOJ

時間限制: 10 s 記憶體限制: 256 MB 總分: 100 公開測試

#5361. Potato Judge

统计

There is a simple problem: you are given $n$ numbers, where $m$ values appear an odd number of times, and the remaining values appear an even number of times. Your task is to find these $m$ numbers.

Unfortunately, the judging system is so ancient that you can only write your program in the archaic programming language Potato. For the syntax of the Potato language, please refer to the provided documentation.

You need to submit a C++ program that outputs a Potato program representing the solution to this problem.

In this problem, the Potato variables $n$ and $m$ are initialized to the $n$ and $m$ values of the test case at the start.

You need to find these $m$ numbers as required by the problem and place them in $\mathtt{result}[0\cdots m-1]$ in any order.

For each test case, there is an additional constraint $\mathrm{cell}$. We will measure how many elements of the array $a$ are modified during the execution of your Potato code (modifying an element multiple times counts as only one modification). Let this value be $V$. If you fail to correctly calculate these $m$ numbers or if $V > \mathrm{cell}$ (meaning you attempted to modify too many elements of array $a$), the test case is failed; otherwise, it is passed.

This problem consists of 8 subtasks, each evaluating 20 test cases. Your C++ code will receive an input $T$ indicating the current subtask number, and you may output different Potato code based on $T$.

For the first 7 subtasks, if you pass at least 18 test cases within that subtask, you receive full marks for that subtask; otherwise, you receive 0 points.

For the 8th subtask, if you pass fewer than 18 test cases, you receive 0 points. Otherwise, your score for this subtask will be calculated based on the maximum value of $V$ among the test cases you passed within these 20 cases.

Additionally, if the total number of instructions executed by your Potato code across all 20 test cases exceeds $2 \times 10^8$, or if the number of lines in your Potato code exceeds $10\,000$, you will receive 0 points for that subtask.

You can use the provided Potato simulator (potato.cpp) to test your program; refer to potato-doc.pdf for usage instructions.

You can also use the provided zip.cpp to package your Potato program. zip.cpp reads a Potato program from stdin and outputs the C++ function output() for that Potato program to stdout. If your Potato code is too long, the packaged output function may exceed the 100KB code length limit.

Input

The first line contains a single positive integer representing the subtask number.

Output

Output the code of the Potato program you have written.

Subtasks

  • Subtask 1 (5 points): $m = 1$, $\mathrm{cell} = 30$.
  • Subtask 2 (10 points): $m \leq 4$, $\mathrm{cell} = 1\,000$.
  • Subtask 3 (5 points): $1 \leq n \leq 100$, $\mathrm{cell} = 120$.
  • Subtask 4 (5 points): Guaranteed that all numbers appear an odd number of times, $\mathrm{cell} = 30$.
  • Subtask 5 (15 points): $1 \leq n \leq 1\,000$, $1 \leq m \leq 10$, $\mathrm{cell} = 30$.
  • Subtask 6 (10 points): $\mathrm{cell} = 1\,000$.
  • Subtask 7 (10 points): $\mathrm{cell} = 100$.
  • Subtask 8 (40 points): Points are awarded based on the number of $\mathrm{cell}$ used. Specifically, if the maximum number of $\mathrm{cell}$ used among the test cases you passed is $x$, you will receive $f(x)$ points, where $f(x)$ is defined as follows:

$$ f(x) = \begin{cases}40 & x \leq 30 \\ 0 & x > 100 \\ \left\lfloor\frac{3000-30x}{40+x}\right\rfloor & \text{otherwise}\end{cases} $$

For all test cases, it is guaranteed that the input numbers are in the range $[0, 2^{32}-1]$, $1 \leq n \leq 2.5 \times 10^4$, and $1 \leq m \leq 10$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.