codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1315C.md (1238B)


      1 Source: https://codeforces.com/problemset/problem/1315/C
      2 
      3 C. Restoring Permutation
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 You are given a sequence $b_1, b_2, \ldots, b_n$. Find the lexicographically minimal permutation $a_1, a_2, \ldots, a_{2n}$ such that $b_i = \min(a_{2i-1}, a_{2i})$, or determine that it is impossible.
     22 
     23 Input
     24 
     25 Each test contains one or more test cases. The first line contains the number of test cases $t$ ($1 \le t \le 100$).
     26 
     27 The first line of each test case consists of one integer $n$ — the number of elements in the sequence $b$ ($1 \le n \le 100$).
     28 
     29 The second line of each test case consists of $n$ different integers $b_1, \ldots, b_n$ — elements of the sequence $b$ ($1 \le b_i \le 2n$).
     30 
     31 It is guaranteed that the sum of $n$ by all test cases doesn't exceed $100$.
     32 
     33 Output
     34 
     35 For each test case, if there is no appropriate permutation, print one number $-1$.
     36 
     37 Otherwise, print $2n$ integers $a_1, \ldots, a_{2n}$ — required lexicographically minimal permutation of numbers from $1$ to $2n$.
     38 
     39 Example
     40 
     41 Input
     42 
     43 ```
     44 5
     45 1
     46 1
     47 2
     48 4 1
     49 3
     50 4 1 3
     51 4
     52 2 3 4 5
     53 5
     54 1 5 7 2 8
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 1 2 
     61 -1
     62 4 5 1 2 3 6 
     63 -1
     64 1 3 5 6 7 9 2 4 8 10
     65 ```