2014 Mudanjiang network qualifying round B (finding rules) zoj3810

Source: Internet
Author: User
A volcanic island Time Limit: 2 seconds memory limit: 65536 kb Special Judge

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

After a lot of multilateral negotiation and occasional armed conflicts,NCountries decided to divide the square volcanic island equally. They partitioned the islandNXNSmall equal-sized square chunks. Each country cocould get a connected region consists of exactNChunks.

Two chunks A and B are called "connected" if they shares 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 meansNRegions shoshould 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 islandNXNChunksNConnected 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 integerTIndicating the number of test cases. For each test case:

There is only an integerN(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
225
Sample output
No solution!YYYGRYGGGRYGYYRBYYYRBBBBR

N x n maps are divided into N connected blocks of different shapes in four colors. If any feasible scheme can be output
Idea: different colors indicate different blocks. 8x8 is used as an example, n = 1, and any color is output directly.
1 <n <= 4, no solution
N = 6, Special Judgment
N is equal to others. The rule is shown in the above 8*8 map.

2014 Mudanjiang network qualifying round B (finding rules) zoj3810

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.