#P7340. 『MdOI R4』Balance
『MdOI R4』Balance
Description
You are given integer arrays of length , and define the function .
You are also given two integers . You need to find a pair such that is the -th smallest among all , and is the -th smallest among all .
In this problem, we say that a number is the -th smallest in a sequence if and only if in there are exactly numbers satisfying , and exactly numbers satisfying , and at the same time .
If no such exists, output 0 0.
If there are multiple such , output any one of them.
Since balance issues cannot be clarified in a single question, the problem setter will ask you multiple times.
Input Format
This problem contains multiple test cases.
The first line contains an integer indicating the number of test cases. For each test case:
The first line contains three positive integers .
In the next lines, each line contains integers. The -th line contains four integers .
Output Format
Output lines. Each line contains two integers, representing the you found.
1
3 3 2
2 4 1 4
10 4 3 4
1 3 1 3
1 3
Hint
[Sample Explanation #1]
- .
- .
- .
is the -rd smallest among , and is the -nd smallest among .
[Constraints]
This problem uses bundled testdata.
| Subtask ID | Score | |||
|---|---|---|---|---|
| No special limit | No special limit | |||
| No special limit | ||||
| No special limit | ||||
| No special limit | ||||
| No special limit |
For of the data, , , , , where denotes the sum of over all test cases.
[Tips and Help]
The input size of this problem is large, so please choose a faster input method.
Translated by ChatGPT 5
京公网安备 11011102002149号