#K54817. Lexicographically Smallest Array Construction

    ID: 29838 Type: Default 1000ms 256MiB

Lexicographically Smallest Array Construction

Lexicographically Smallest Array Construction

Given two arrays \(a\) and \(b\) of length \(n\), construct an array \(c\) of the same length such that for each index \(i\) (where \(1 \le i \le n\)), \(c_i = \max(a_i, b_i)\). Although the problem statement mentions the lexicographically smallest arrangement, note that the only valid choice for \(c_i\) is \(\max(a_i, b_i)\) for each \(i\) independently.

Input: An integer \(n\) followed by two lines of \(n\) integers each representing arrays \(a\) and \(b\).

Output: A single line containing \(n\) integers separated by a space which form the array \(c\).

Formula: \(c_i = \max(a_i, b_i)\) for \(i=1,2,\dots,n\).

inputFormat

The first line contains a single integer \(n\) (the size of the arrays). The second line contains \(n\) space-separated integers representing array \(a\). The third line contains \(n\) space-separated integers representing array \(b\).

outputFormat

Output a single line with \(n\) integers separated by a space, forming the array \(c\) where each element is defined as \(c_i = \max(a_i, b_i)\).

## sample
3
1 2 3
3 2 1
3 2 3