2014牡丹江网络预选赛B题(找规律)zoj3810
2014-09-09 00:02
453 查看
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 into N 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.
There is only an integer N (1 <= N <= 100).
drawing the map.
题意:在n*n的地图上用四种颜色划分出n个不同形状的连通块,如果可行输出任意可行的方案
思路 : 如图所示,不同颜色表示不同的块,8*8为例
![](http://img.blog.csdn.net/20140909001356671?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FfcGhxZw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
![](file:///C:\Users\lenovo\AppData\Roaming\Tencent\Users\451628394\QQ\WinTemp\RichOle\OD~Z2WZ1BN%~IE4T4$4IU4U.jpg)
![](file:///C:\Users\lenovo\AppData\Roaming\Tencent\Users\451628394\QQ\WinTemp\RichOle\OD~Z2WZ1BN%~IE4T4$4IU4U.jpg)
n=1,直接输出任意颜色
1<n<=4,无解
n=6,特殊判断
n等于其它,规律如上8*8的地图
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 into N 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 todrawing the map.
Sample Input
2 2 5
Sample Output
No solution! YYYGR YGGGR YGYYR BYYYR BBBBR
题意:在n*n的地图上用四种颜色划分出n个不同形状的连通块,如果可行输出任意可行的方案
思路 : 如图所示,不同颜色表示不同的块,8*8为例
![](file:///C:\Users\lenovo\AppData\Roaming\Tencent\Users\451628394\QQ\WinTemp\RichOle\OD~Z2WZ1BN%~IE4T4$4IU4U.jpg)
![](file:///C:\Users\lenovo\AppData\Roaming\Tencent\Users\451628394\QQ\WinTemp\RichOle\OD~Z2WZ1BN%~IE4T4$4IU4U.jpg)
n=1,直接输出任意颜色
1<n<=4,无解
n=6,特殊判断
n等于其它,规律如上8*8的地图
相关文章推荐
- ZOJ 3809 The Himalayas (2014 ACM/ICPC 牡丹江站 网络预选赛 A 题)
- ZOJ 3818 The Himalayas (2014 ACM/ICPC 牡丹江站 网络预选赛 J 题)
- 2014牡丹江网络预选赛I题(字符串hash+简单DP)zoj3817
- 2014牡丹江网络预选赛F题(隐式图BFS暴搜)zoj3814
- [ACM] zoj 3809 The Himalayas (2014 ACMICPC Regional 牡丹江站网络赛 A题)
- ZOJ 3812 We Need Medicine(dp,状态压缩,2014牡丹江网络赛D题)
- 2014 ACM-ICPC亚洲区域赛牡丹江站网络预选赛 C Untrusted Patrol
- ZOJ 3810 A Volcanic Island (2014年牡丹江赛区网络赛B题)
- ZOJ 3811 / 2014 牡丹江赛区网络赛 C. Untrusted Patrol bfs/dfs/并查集
- ZOJ 3814 / 2014 牡丹江赛区网络赛 F. Sawtooth Puzzle
- 2014牡丹江网络预选赛D题(状压DP)zoj3812
- ZOJ 3810 A Volcanic Island (2014年牡丹江赛区网络赛B题)
- 2014牡丹江网络预选赛E题(线段树)zoj3813
- ZOJ-3811 Untrusted Patrol DFS 2014牡丹江网络赛C题
- zoj 3813 Alternating Sum(2014ACMICPC Regional 牡丹江站网络赛 E)
- zoj 3811 Untrusted Patrol 2014牡丹江网络赛 dfs
- ZOJ 3811 / 2014 牡丹江赛区网络赛 C. Untrusted Patrol
- zoj 3813 Alternating Sum(2014ACMICPC Regional 牡丹江站网络赛 E)
- zoj 3813 Alternating Sum(2014ACMICPC Regional 牡丹江站网络赛 E)
- 牡丹江2014网络赛 E zoj—3813 规律与线段树