CF369B.Valera and Contest

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

After the contest was over, Valera was interested in results. He found out that:

  • each student in the team scored at least l points and at most r points;
  • in total, all members of the team scored exactly s__all points;
  • 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.

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.

瓦莱拉热衷于参加各类竞赛,尤其是编程竞赛。今天,他与一支由 nn 名学生(包括瓦莱拉本人)组成的队伍参加了比赛。本次比赛为个人赛,因此队伍中的每名学生均独立解题。

比赛结束后,瓦莱拉对成绩产生了兴趣。他了解到以下信息:

  • 队伍中每名学生的得分均不少于 ll 分,且不多于 rr 分;
  • 队伍所有成员的总得分为恰好 salls_{\text{all}} 分;
  • 队伍中得分最高的 kk 名学生的得分之和恰好为 sks_k;更准确地说,若 a1, a2, …, ana_1,\,a_2,\,\dots,\,a_n 表示该学生队伍按非递增顺序排列的得分序列(即 a1≥a2≥⋯≥ana_1 \ge a_2 \ge \dots \ge a_n),则有 sk=a1+a2+⋯+aks_k = a_1 + a_2 + \dots + a_k。

然而,瓦莱拉并未获知这 nn 名学生各自的具体得分。他请你重构出任意一种满足上述所有条件的学生得分分配方案。

输入格式

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).

It's guaranteed that the input is such that the answer exists.

输入的第一行恰好包含六个整数 nn、kk、ll、rr、salls_{\text{all}}、sks_k(其中 1≤n,k,l,r≤10001 \leq n, k, l, r \leq 1000;l≤rl \leq r;k≤nk \leq n;1≤sk≤sall≤1061 \leq s_k \leq s_{\text{all}} \leq 10^6)。

保证输入数据满足答案一定存在。

输出格式

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.

精确输出 nn 个整数 a1, a2, …, ana_1,\,a_2,\,\dots,\,a_n —— 每位学生所得的分数。若存在多种解,输出任意一种即可。分数的分配顺序可以任意。

输入输出样例

  • 输入#1

    5 3 1 3 13 9

    输出#1

    2 3 2 3 3
  • 输入#2

    5 3 1 3 15 9

    输出#2

    3 3 3 3 3

输入解题思路,AI测评打分。不知道怎么写?

首页