CF216C.Hiring Staff

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

A new Berland businessman Vitaly is going to open a household appliances' store. All he's got to do now is to hire the staff.

The store will work seven days a week, but not around the clock. Every day at least k people must work in the store.

Berland has a law that determines the order of working days and non-working days. Namely, each employee must work for exactly n consecutive days, then rest for exactly m days, then work for n more days and rest for m more, and so on. Vitaly doesn't want to break the law. Fortunately, there is a loophole: the law comes into force on the day when the employee is hired. For example, if an employee is hired on day x, then he should work on days [x, x + 1, ..., x + n - 1], [x + m + n, x + m + n + 1, ..., x + m + 2_n_ - 1], and so on. Day x can be chosen arbitrarily by Vitaly.

There is one more thing: the key to the store. Berland law prohibits making copies of keys, so there is only one key. Vitaly is planning to entrust the key to the store employees. At the same time on each day the key must be with an employee who works that day — otherwise on this day no one can get inside the store. During the day the key holder can give the key to another employee, if he also works that day. The key will handed to the first hired employee at his first working day.

Each employee has to be paid salary. Therefore, Vitaly wants to hire as few employees as possible provided that the store can operate normally on each day from 1 to infinity. In other words, on each day with index from 1 to infinity, the store must have at least k working employees, and one of the working employees should have the key to the store.

Help Vitaly and determine the minimum required number of employees, as well as days on which they should be hired.

一位新的贝尔兰商人维塔利正准备开设一家家用电器商店。他目前需要完成的唯一任务是招聘员工。

该商店每周营业七天,但并非全天候营业。每天在商店内工作的员工人数至少为 kk 人。

贝尔兰有一项法律规定了员工工作日与休息日的安排顺序:每位员工必须连续工作恰好 nn 天,然后连续休息恰好 mm 天,接着再连续工作 nn 天、再连续休息 mm 天,依此类推。维塔利不想违反这项法律。幸运的是,存在一个法律漏洞:该法律自员工被聘用之日才开始生效。例如,若某员工于第 xx 天被聘用,则他应在如下日期工作:

[x, x+1, …, x+n−1],[x+m+n, x+m+n+1, …, x+m+2n−1],…[x,\ x+1,\ \dots,\ x+n-1],\quad [x+m+n,\ x+m+n+1,\ \dots,\ x+m+2n-1],\quad \dots

其中起始日 xx 可由维塔利任意选定。

还有一点需要注意:商店的钥匙。贝尔兰法律禁止复制钥匙,因此全店仅有一把钥匙。维塔利计划将这把钥匙交由商店员工保管。但要求是:每一天中,钥匙必须由当天在岗的一名员工持有——否则当天将无人能进入商店。在同一天内,持钥员工可将钥匙转交给另一名当天也在岗的员工。钥匙将在第一位被聘用员工的首个工作日交予他。

每位员工均需支付薪水。因此,在保证商店从第 11 天起至无穷远的每一天均能正常运营的前提下,维塔利希望聘用尽可能少的员工。换言之,对每个下标为 1,2,3,…1,2,3,\dots 的日子,商店当天必须至少有 kk 名员工在岗,且其中至少一人持有商店钥匙。

请帮助维塔利确定所需的最少员工数量,以及他们各自的聘用日期。

输入格式

The first line contains three integers n, m and k (1 ≤ m ≤ n ≤ 1000, n ≠ 1, 1 ≤ k ≤ 1000).

第一行包含三个整数 nn、mm 和 kk(1 ≤ m ≤ n ≤ 10001 ≤ m ≤ n ≤ 1000,n ≠ 1n ≠ 1,1 ≤ k ≤ 10001 ≤ k ≤ 1000)。

输出格式

In the first line print a single integer z — the minimum required number of employees.

In the second line print z positive integers, separated by spaces: the i-th integer a__i (1 ≤ a__i ≤ 104) should represent the number of the day, on which Vitaly should hire the i-th employee.

If there are multiple answers, print any of them.

第一行输出一个整数 zz —— 所需员工的最少人数。

第二行输出 zz 个正整数,以空格分隔:第 ii 个整数 aia_i(1≤ai≤1041 \leq a_i \leq 10^4)应表示 Vitaly 聘用第 ii 个员工的日期编号。

若存在多个答案,输出任意一个即可。

输入输出样例

  • 输入#1

    4 3 2

    输出#1

    4
    1 1 4 5
  • 输入#2

    3 3 1

    输出#2

    3
    1 3 5

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

首页