-->
当前位置:首页 > 题库

PROGRAMMING:Median of two ordered sequences

Luz5年前 (2021-05-10)题库482
It is known that there are two non descending sequences S1 and S2. Find the low median of S1 and S2. The median of ordered sequence A0, A1,..., an − 1 refers to the value of a (n − 1) / 2, that is, the number of ⌊ (n + 1) / 2 ⌋ (A0 is the first number).
###Input format:
The input is divided into four lines. The first line gives the length N1 of the first sequence (0 < N1 ≤ 2500000), followed by the information of the first sequence, that is, N1 non descending integers. The numbers are separated by spaces. Then there is the length N2 (0 < N2 ≤ 2500000) and information of the second sequence. Because the test data can only be 10 m, 2.5 * 10 of the sixth power scale, dichotomy effect is not obvious, if 10 of the seventh power data scale, dichotomy is generally 20 ms faster than merging. The eighth power of 10 is faster than 200 ms. The main problem is that the input takes a lot of time, such as search timeout, try to submit many times.
###Output format:
Outputs the low median of the union sequence of two input sequences in a row.
###Input example: 2
Here is a set of inputs. For example:
```in
three
1 2 3
five
4 5 6 7 8
```
###Output example:
The corresponding output is given here. For example:
```out
four
```







answer:If there is no answer, please comment