#C932. Interleaving Two Arrays

    ID: 53400 Type: Default 1000ms 256MiB

Interleaving Two Arrays

Interleaving Two Arrays

You are given two arrays A and B, each containing n integers. Your task is to create a new array C by interleaving the elements from A and B. Specifically, the element at index 0 in C should be the first element of A, index 1 should be the first element of B, index 2 should be the second element of A, index 3 should be the second element of B, and so on.

If the arrays cannot be interleaved because the number of elements in either array does not match n, your program should output \(-1\) (in LaTeX: \(-1\)). If n is \(0\), the output should be an empty array (i.e., no output).

inputFormat

The input consists of three lines:

  • The first line contains an integer \(n\) representing the number of elements in each array.
  • The second line contains \(n\) space-separated integers representing array A.
  • The third line contains \(n\) space-separated integers representing array B.

outputFormat

If the input is valid, output the interleaved array as space-separated integers in one line. If the input is invalid (i.e. when the length of A or B does not equal \(n\)), output \(-1\) (printed as -1).

## sample
3
1 2 3
4 5 6
1 4 2 5 3 6