A9648 | Pashmak and Buses
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Recently Pashmak has been employed in a transportation company. The company has $k$ buses and has a contract with a school which has $n$ students. The school planned to take the students to $d$ different places for $d$ days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrange the students in the buses. He wants to arrange the students in a way that no two students become close friends. In his ridiculous idea, two students will become close friends if and only if they are in the same buses for all $d$ days.
Please help Pashmak with his weird idea. Assume that each bus has an unlimited capacity.
Please help Pashmak with his weird idea. Assume that each bus has an unlimited capacity.
输入格式
The first line of input contains three space-separated integers $n,k,d$ $(1<=n,d<=1000; 1<=k<=10^{9})$ .
输出格式
If there is no valid arrangement just print -1. Otherwise print $d$ lines, in each of them print $n$ integers. The $j$ -th integer of the $i$ -th line shows which bus the $j$ -th student has to take on the $i$ -th day. You can assume that the buses are numbered from $1$ to $k$ .
输入输出样例
输入 #1
3 2 2
输出 #1
1 1 2 1 2 1
输入 #2
3 2 1
输出 #2
-1
Note that two students become close friends only if they share a bus each day. But the bus they share can differ from day to day.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted