#P10417. [蓝桥杯 2023 国 A] 第 K 小的和
[蓝桥杯 2023 国 A] 第 K 小的和
Problem Description
Given two sequences and , with lengths and , respectively.
Define another sequence that contains all pairwise sums of numbers from and ( has a total of numbers). Ask what the -th smallest number in is. Note that duplicate values must be counted multiple times. For example, in , both the smallest and the second smallest are , and is the -th smallest.
Input Format
The first line contains three integers , separated by one space between adjacent integers.
The second line contains integers, representing , separated by one space between adjacent integers.
The third line contains integers, representing , separated by one space between adjacent integers.
Output Format
Output one line containing one integer, which is the answer.
3 4 5
1 3 4
2 3 5 6
6
Hint
【Constraints and Conventions for Testcases】
- For of the testcases, , .
- For all testcases, , , .
Translated by ChatGPT 5