CF720C.Homework
NOI/NOI+/CTSC
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Today Peter has got an additional homework for tomorrow. The teacher has given three integers to him: n, m and k, and asked him to mark one or more squares on a square grid of size n × m.
The marked squares must form a connected figure, and there must be exactly k triples of marked squares that form an L-shaped tromino — all three squares are inside a 2 × 2 square.
The set of squares forms a connected figure if it is possible to get from any square to any other one if you are allowed to move from a square to any adjacent by a common side square.
Peter cannot fulfill the task, so he asks you for help. Help him to create such figure.
今天,彼得收到了一项额外的作业,要求明天完成。老师给了他三个整数:n、m 和 k,并要求他在一个 n×m 的方格网格上标记一个或多个方格。
所标记的方格必须构成一个连通图形,且其中恰好有 k 个标记的方格三元组能组成一个 L 形三格骨牌(L-shaped tromino)——即这三个方格全部位于某个 2×2 的子方格内。
当且仅当从任意一个被标记的方格出发,可通过若干次移动(每次只能移动到与当前方格有一条公共边的相邻方格)到达其他任意一个被标记的方格时,该方格集合称为连通图形。
彼得无法完成这项任务,因此向你求助。请你帮他构造出满足条件的图形。
输入格式
Input data contains one or more test cases. The first line contains the number of test cases t (1 ≤ t ≤ 100).
Each of the following t test cases is described by a line that contains three integers: n, m and k (3 ≤ n, m, n × m ≤ 105, 0 ≤ k ≤ 109).
The sum of values of n × m for all tests in one input data doesn't exceed 105.
输入数据包含一个或多个测试用例。第一行包含测试用例的数量 t(1 ≤ t ≤ 100)。
接下来的 t 行,每行描述一个测试用例,包含三个整数:n、m 和 k(3 ≤ n,m,n × m ≤ 105,0 ≤ k ≤ 109)。
所有测试用例的 n × m 值之和不超过 105。
输出格式
For each test case print the answer.
If it is possible to create such figure, print n lines, m characters each, use asterisk '*' to denote the marked square, and dot '.' to denote the unmarked one.
If there is no solution, print -1.
Print empty line between test cases.
对每个测试用例,输出答案。
如果能够构造出这样的图形,则输出 n 行,每行 m 个字符:用星号 * 表示被标记的方格,用英文句点 . 表示未被标记的方格。
如果无解,则输出 -1。
测试用例之间需输出一个空行。
输入输出样例
输入#1
3 3 3 4 3 3 5 3 3 3
输出#1
.*. *** .*. **. **. *.. .*. *** *..
输入解题思路,AI测评打分。不知道怎么写?