A Plus B

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Borcsa has two arrays, each of them containing $N$ non-negative integers.

The numbers in the first array are $A[0],A[1], \dots ,A[N - 1]$ and the numbers in the second array are $B[0],B[1], \dots ,B[N - 1]$. The numbers in both arrays are in increasing order, that is,

  • $A[0] ≤ A[1] ≤ \dots ≤ A[N - 1]$, and
  • $B[0] ≤ B[1] ≤ … ≤ B[N - 1]$.

Borcsa really likes arithmetical addition, so for each $i$ from $0$ to $N - 1$ and for each $j$ from $0$ to $N - 1$, inclusive, she computed the sum $A[i] + B[j]$.

Let array $C$ contain all $N^2$ sums computed by Borcsa, sorted in increasing order. Your task is to find the first $N$ values in $C$.

제한

  • $1 ≤ N ≤ 100\,000$
  • $0 ≤ A[i] ≤ 10^9$ (for each $i$ such that $0 ≤ i < N$)
  • $0 ≤ B[i] ≤ 10^9$ (for each $i$ such that $0 ≤ i < N$)
  • $A$ and $B$ are sorted in increasing order.