zoj 3810 A Volcanic Island 构造不同图形

A Volcanic Island

Time Limit: 2 Seconds       Memory Limit: 65536 KB       Special Judge

An underwater volcano has erupted massively in somewhere of the deep Atlantis Ocean. This large eruption led to the birth of a new volcanic island, which had a shape of square. Near the island, there are N countries. All of them have claimed the sovereignty over the island.

After a lot of multilateral negotiation and occasional armed conflicts, the N countries decided to divide the square volcanic island equally. They partitioned the island intoN x N small equal-sized square chunks. Each country could get a connected region consists of exact N chunks.

Two chunks A and B are called "connected" if they share an edge, or there exists another chunk C connected with both A and B. A group of chunks are called "connected region" if any two of these chunks are connected.

Every country want a unique region. It means the N regions should be different with each other. Two regions are considered as the same if and only if one can transform into the other by an isometry (a combination of rigid motions, including translation, rotation and reflection).

In a nutshell, your task is to divide a square island with N x N chunks into N connected regions with different shape. You also need to draw a map to color the regions of the map so that no two edge-adjacent regions have the same color. Most of the people in these countries believed that four different colors are enough. So you can mark these regions with at most four colors, red, green, blue and yellow.

Input

There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:

There is only an integer N (1 <= N <= 100).

Output

For each test case, output a valid map described above. If there is no solution, output "No solution!" instead. Please note that only four colors ('R', 'G', 'B' and 'Y') can be used to drawing the map.

Sample Input
2
2
5
Sample Output
No solution!
YYYGR
YGGGR
YGYYR
BYYYR
BBBBR
 
题意: 让你在n*n图中构造出GRYB四种颜色组成的图型,相邻图形颜色不通。
面积全为n,个数也是n;
然后各个图形形状绝对不同,也就是旋转或者对称变换后,仍然与所有其他块形状不通;
如图构造
注意n==1 的情况;
 
 
 

                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值