codeforces-scrape

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

414A.md (1723B)


      1 Source: https://codeforces.com/problemset/problem/414/A
      2 
      3 A. Mashmokh and Numbers
      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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh.
     22 
     23 In this game Mashmokh writes sequence of *n* distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he removes the first and the second integer of the remaining sequence from the board, and so on. Bimokh stops when the board contains less than two numbers. When Bimokh removes numbers *x* and *y* from the board, he gets *gcd*(*x*, *y*) points. At the beginning of the game Bimokh has zero points.
     24 
     25 Mashmokh wants to win in the game. For this reason he wants his boss to get exactly *k* points in total. But the guy doesn't know how choose the initial sequence in the right way.
     26 
     27 Please, help him. Find *n* distinct integers *a*1, *a*2, ..., *a**n* such that his boss will score exactly *k* points. Also Mashmokh can't memorize too huge numbers. Therefore each of these integers must be at most 109.
     28 
     29 Input
     30 
     31 The first line of input contains two space-separated integers *n*, *k* (1 ≤ *n* ≤ 105; 0 ≤ *k* ≤ 108).
     32 
     33 Output
     34 
     35 If such sequence doesn't exist output -1 otherwise output *n* distinct space-separated integers *a*1, *a*2, ..., *a**n* (1 ≤ *a**i* ≤ 109).
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 5 2
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 1 2 3 4 5
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 5 3
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 2 4 3 7 1
     61 ```
     62 
     63 Input
     64 
     65 ```
     66 7 2
     67 ```
     68 
     69 Output
     70 
     71 ```
     72 -1
     73 ```
     74 
     75 Note
     76 
     77 *gcd*(*x*, *y*) is greatest common divisor of *x* and *y*.