codeforces-scrape

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

369B.md (1915B)


      1 Source: https://codeforces.com/problemset/problem/369/B
      2 
      3 B. Valera and Contest
      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 Valera loves to participate in competitions. Especially in programming contests. Today he has participated in the contest with his team, consisting of *n* students (including Valera). This contest was an individual competition, so each student in the team solved problems individually.
     22 
     23 After the contest was over, Valera was interested in results. He found out that:
     24 
     25 * each student in the team scored at least *l* points and at most *r* points;
     26 * in total, all members of the team scored exactly *s**all* points;
     27 * the total score of the *k* members of the team who scored the most points is equal to exactly *s**k*; more formally, if *a*1, *a*2, ..., *a**n* is the sequence of points earned by the team of students in the non-increasing order (*a*1 ≥ *a*2 ≥ ... ≥ *a**n*), then *s**k* = *a*1 + *a*2 + ... + *a**k*.
     28 
     29 However, Valera did not find out exactly how many points each of *n* students scored. Valera asked you to recover any distribution of scores between the students of the team, such that all the conditions above are met.
     30 
     31 Input
     32 
     33 The first line of the input contains exactly six integers *n*, *k*, *l*, *r*, *s**all*, *s**k* (1 ≤ *n*, *k*, *l*, *r* ≤ 1000; *l* ≤ *r*; *k* ≤ *n*; 1 ≤ *s**k* ≤ *s**all* ≤ 106).
     34 
     35 It's guaranteed that the input is such that the answer exists.
     36 
     37 Output
     38 
     39 Print exactly *n* integers *a*1, *a*2, ..., *a**n* — the number of points each student scored. If there are multiple solutions, you can print any of them. You can print the distribution of points in any order.
     40 
     41 Examples
     42 
     43 Input
     44 
     45 ```
     46 5 3 1 3 13 9
     47 ```
     48 
     49 Output
     50 
     51 ```
     52 2 3 2 3 3
     53 ```
     54 
     55 Input
     56 
     57 ```
     58 5 3 1 3 15 9
     59 ```
     60 
     61 Output
     62 
     63 ```
     64 3 3 3 3 3
     65 ```