302385: CF459C. Pashmak and Buses
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Pashmak and Buses
题意翻译
题目描述 最近pashmak被运输公司录用了,公司有k辆车,现在有个学校n个学生要用车,学校要将这些学生送到d个不同地方,每个地方呆1天,总共要d天。每天公司要提供车运输这些学生,pashmak就要安排方案。学校为了防止这些学生太过亲密,不希望有任意两个学生d天内都是同一辆车。问pashmak能否合理安排。 注意,我们假设每辆车的容量是无限的。 输入 输入3个数,n, k, d (1 <= n, d <= 1000; 1 <= k <= 10 ^9) 输出 如果可以输出”yes” 然后输出n行,每行d个数,每行输出每个人的安排车辆(车辆编号是从1到k) 方案有多种,这里要求输出字典序最小的一种 不可以输出”no” 样例输入 3 2 2 样例输出 yes 1 1 1 2 2 1 提示 输入 3 2 1 输出 no题目描述
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.输入输出格式
输入格式
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