#C6130. Lexicographically Smallest Array Construction
Lexicographically Smallest Array Construction
Lexicographically Smallest Array Construction
Given two integer arrays (a) and (b) of equal length (n), construct an array (c) such that for each index (i) (where (1 \leq i \leq n)), (c_i = a_i + \min(b)). In other words, let (m = \min(b)) then for each (i), (c_i = a_i + m). This guarantees that the resulting array (c) is lexicographically smallest obtainable using the same offset for all elements.
inputFormat
The input is given via standard input and consists of three lines:
- The first line contains a single integer (n) ((1 \le n \le 10^5)) representing the number of elements in each array.
- The second line contains (n) space-separated integers representing the array (a).
- The third line contains (n) space-separated integers representing the array (b).
outputFormat
Output a single line containing (n) space-separated integers representing the constructed array (c), where each element (c_i = a_i + \min(b)).## sample
3
1 2 3
4 5 6
5 6 7