atcoder#ABC282F. [ABC282F] Union of Two Sets
[ABC282F] Union of Two Sets
Score : points
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 .
- 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:
l_i r_i
(Phase )
- First, is given from the input.
- In each query, integers and representing the query are given in the following format:
L R
- In response to each query, two integers and should be printed in the following format:
a b
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 |
is given. | |
6 |
You print . | |
3 3 |
You print . | |
4 4 |
You print . | |
1 1 |
You print . | |
2 4 |
You print . | |
1 3 |
You print . | |
2 2 |
You print . | |
4 |
is given. | |
1 3 |
As the first query, and are given. | |
1 5 |
You respond with and . | |
3 4 |
As the second query, and are given. | |
2 1 |
You respond with and . | |
2 4 |
As the third query, and are given. | |
4 4 |
You respond with and . | |
1 1 |
As the fourth query, and are given. | |
3 3 |
You respond with and . | |