Hexagon

TimeLimit:2000MS  MemoryLimit:524288KB
64-bit integer IO format:%I64d
Special Judge
未提交 | 登录后收藏
Problem Description
It is preferrable to read the pdf statment.

If the world is a hexagon, I will take as many turns as possible before reaching the end.

Cuber QQ has constructed a hexagon grid with radius $n$. This will be better if explained in a picture. For example, this is a hexagon grid with radius $3$:



He challenges you take a perfect tour over the hexagon, that is to visit each cell exactly once. Starting from any point in the grid, you can move to any adjacent cell in each step. There are six different directions you can choose from:



Of course, if you are on the boundary, you cannot move outside of the hexagon.

Let $D(x,y)$ denote the direction from cell $x$ to $y$, and sequence $A$ denotes your route, in which $A_i$ denotes the $i$-th cell you visit. For index $i$ ($1 < i < |A|$), if $D(A_{i-1},A_i) \ne D(A_i,A_{i+1})$, we say there is a turning on cell $i$.

Maximize the number of turning while ensuring that each cell is visited exactly once. Print your route. If there are multiple solution, print any.
Input
The first line of the input contains a single integer $T$ ($1\le T\le 10^4$), denoting the number of test cases.

Each of the next $T$ cases:

The first line contains an integer $n$ ($2\le n\le 500$).

It is guaranteed that the sum of $n$ doesn't exceed $2 \cdot 10^4$.
Output
For each test case, output one line contains a string with $3(n-1)n$ characters. The $i$-th character is $D(A_i,A_{i+1})$.
SampleInput
1
2
SampleOutput
313456
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: