#abc282f. F - Union of Two Sets
F - Union of Two Sets
Score : points
问题描述
这是一个交互式任务,你编写的程序和裁判程序将通过标准输入和输出进行互动。
你们将遵循以下步骤进行操作。该过程包括阶段1和阶段2,其中阶段1紧接着阶段2执行。
(阶段1)
- 裁判给出一个整数 。
- 你需要打印一个整数 ,其范围在 到 (包含两端点)之间。
- 你还需要打印 对整数 ,确保对于所有 ,满足 (这 对整数不需要互不相同)。
(阶段2)
- 裁判给出一个整数 。
- 你与裁判重复以下步骤共 次。
- 裁判给出一对查询用的整数 和 。
- 你需要回应两个整数 和 ,它们的范围在 到 (包含两端点)之间(可能有 )。这里, 和 必须满足以下条件,否则你的提交将被判为错误。
- 集合 与集合 的并集等于集合 。
在完成上述流程后,请立即终止程序以获得正确评判。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
This is an interactive task, where your and the judge's programs interact via Standard Input and Output.
You and the judge will follow the procedure below. The procedure consists of phases and ; phase is immediately followed by phase .
(Phase )
- The judge gives you an integer .
- You print an integer between and , inclusive.
- You also print pairs of integers such that for every (the pairs do not have to be distinct).
(Phase )
- The judge gives you an integer .
- You and the judge repeats the following times.
- The judge gives you two integers and as a query.
- You respond with two integers and between and , inclusive (possibly with ). Here, and must satisfy the condition below. Otherwise, your submission will be judged incorrect.
- The union of the set and the set equals the set .
After the procedure above, terminate the program immediately to be judged correct.
Constraints
- All values in the input are integers.
Input and Output
This is an interactive task, where your and the judge's programs interact via Standard Input and Output.
(Phase )
-
First, is given from the input.
-
Next, an integer between and , inclusive, should be printed.
-
Then, should be printed, one at a time. Specifically, for each , the -th output should be in the following format:
(Phase )
-
First, is given from the input.
-
In each query, integers and representing the query are given in the following format:
- In response to each query, two integers and should be printed in the following format:
Cautions
- At the end of each output, print a newline and flush Standard Output. Otherwise, you may get the TLE verdict.
- If your program prints a malformed output or quits prematurely, the verdict will be indeterminate. Particularly, note that in case of a runtime error, the verdict may be WA or TLE instead of RE.
- After phase , immediately terminate the program. Otherwise, the verdict will be indeterminate.
- and given in phase will be decided according to you print in phase .
Sample Interaction
Below is a sample interaction with and .
Input | Output | Description |
---|---|---|
4 | $N$ is given. | |
6 | You print $M$. | |
3 3 | You print $(l_1, r_1) = (3, 3)$. | |
4 4 | You print $(l_2, r_2) = (4, 4)$. | |
1 1 | You print $(l_3, r_3) = (1, 1)$. | |
2 4 | You print $(l_4, r_4) = (2, 4)$. | |
1 3 | You print $(l_5, r_5) = (1, 3)$. | |
2 2 | You print $(l_6, r_6) = (2, 2)$. | |
4 | $Q$ is given. | |
1 3 | As the first query, $L = 1$ and $R = 3$ are given. | |
1 5 | You respond with $a = 1$ and $b = 5$. | |
3 4 | As the second query, $L = 3$ and $R = 4$ are given. | |
2 1 | You respond with $a = 2$ and $b = 1$. | |
2 4 | As the third query, $L = 2$ and $R = 4$ are given. | |
4 4 | You respond with $a = 4$ and $b = 4$. | |
1 1 | As the fourth query, $L = 1$ and $R = 1$ are given. | |
3 3 | You respond with $a = 3$ and $b = 3$. | |
update @ 2024/3/10 11:50:56