A10647 | Homework
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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<=10^{5}$ , $0<=k<=10^{9}$ ).
The sum of values of $n×m$ for all tests in one input data doesn't exceed $10^{5}$ .
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<=10^{5}$ , $0<=k<=10^{9}$ ).
The sum of values of $n×m$ for all tests in one input data doesn't exceed $10^{5}$ .
输出格式
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.
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.
输入输出样例
输入 #1
3 3 3 4 3 3 5 3 3 3
输出 #1
.*. *** .*. **. **. *.. .*. *** *..
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted