codeforces-scrape

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

856A.md (1694B)


      1 Source: https://codeforces.com/problemset/problem/856/A
      2 
      3 A. Set Theory
      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 Masha and Grisha like studying sets of positive integers.
     22 
     23 One day Grisha has written a set *A* containing *n* different integers *a**i* on a blackboard. Now he asks Masha to create a set *B* containing *n* different integers *b**j* such that all *n*2 integers that can be obtained by summing up *a**i* and *b**j* for all possible pairs of *i* and *j* are different.
     24 
     25 Both Masha and Grisha don't like big numbers, so all numbers in *A* are from 1 to 106, and all numbers in *B* must also be in the same range.
     26 
     27 Help Masha to create the set *B* that satisfies Grisha's requirement.
     28 
     29 Input
     30 
     31 Input data contains multiple test cases. The first line contains an integer *t* — the number of test cases (1 ≤ *t* ≤ 100).
     32 
     33 Each test case is described in the following way: the first line of the description contains one integer *n* — the number of elements in *A* (1 ≤ *n* ≤ 100).
     34 
     35 The second line contains *n* integers *a**i* — the elements of *A* (1 ≤ *a**i* ≤ 106).
     36 
     37 Output
     38 
     39 For each test first print the answer:
     40 
     41 * NO, if Masha's task is impossible to solve, there is no way to create the required set *B*.
     42 * YES, if there is the way to create the required set. In this case the second line must contain *n* different positive integers *b**j* — elements of *B* (1 ≤ *b**j* ≤ 106). If there are several possible sets, output any of them.
     43 
     44 Example
     45 
     46 Input
     47 
     48 ```
     49 3  
     50 3  
     51 1 10 100  
     52 1  
     53 1  
     54 2  
     55 2 4
     56 ```
     57 
     58 Output
     59 
     60 ```
     61 YES  
     62 1 2 3   
     63 YES  
     64 1   
     65 YES  
     66 1 2
     67 ```