A8574 | Hiring Staff
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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+2n-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.
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+2n-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.
输入格式
The first line contains three integers $n$ , $m$ and $k$ ( $1<=m<=n<=1000$ , $n≠1$ , $1<=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}<=10^{4}$ ) 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.
In the second line print $z$ positive integers, separated by spaces: the $i$ -th integer $a_{i}$ ( $1<=a_{i}<=10^{4}$ ) 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.
输入输出样例
输入 #1
4 3 2
输出 #1
4 1 1 4 5
输入 #2
3 3 1
输出 #2
3 1 3 5
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted