#K42882. Common Subarray Extraction
Common Subarray Extraction
Common Subarray Extraction
You are given an integer n and an array a of length (2n-1). Your task is to construct an array b of length n which is a subarray of a according to the following criterion: simply select the first n elements of a.
In other words, if (a = [a_1, a_2, \ldots, a_{2n-1}]), then output (b = [a_1, a_2, \ldots, a_n]).
This problem may seem trivial, but it tests your ability to correctly parse input and implement simple array manipulations under competitive programming input/output conditions.
inputFormat
The input is read from standard input and is formatted as follows:
(t) — the number of test cases.
For each test case:
- An integer n on a separate line.
- A line containing (2n - 1) space-separated integers representing the array a.
outputFormat
For each test case, output the chosen subarray b (the first n elements of a) on a new line. The elements should be printed as space-separated integers.## sample
3
1
5
3
1 2 3 4 5
4
3 3 3 3 3 3 3
5
1 2 3
3 3 3 3
</p>