Universal Cup Judging System

Universal Cup

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓
Statistics

問題文

$n \ge 1$ とします。互いに平行な 3 組の線分を引くことで、大きな三角形を $n^2$ 個の小さな三角形に分割する次の標準的な方法を考えます。

problem_17171_1.png

これは自然に $(n + 1)(n + 2)/2$ 個の頂点と $3n(n + 1)/2$ 本の辺を持つ無向グラフを定めます。頂点は格子のノード、すなわち線分の交点(図中で太く示された点)であり、辺は隣接するノード間の線分です。あなたの課題は、三角形の最も上の頂点から「出発する」このグラフの辺上のオイラー閉路を 1 つ構成することです。言い換えると、最も上の頂点から出発し、辺に沿って移動して各辺をちょうど 1 回ずつ通り、最後に最も上の頂点に戻る必要があります。解が常に存在することは証明できます。

入力

整数 $n$ が与えられます。範囲は $1$ から $20$ までです。

出力

グラフのあるオイラー閉路を表す、$0$ から $5$ までの数字ちょうど $3n(n + 1)/2$ 文字からなる文字列を次の形式で出力してください。$0$ は現在の頂点から真右へ移動すること、$1$ は右上方向へ移動すること、$2$ は左上方向へ移動すること、$3$ は真左へ移動すること、$4$ は左下方向へ移動すること、$5$ は右下方向へ移動することを意味します。分かりやすさのため、各方向を下図に示します。

problem_17171_33d5f69dce15e1d87a6778f3f3d32524.png

走査は一番上の頂点から開始しなければなりません。可能な走査であればどれを出力しても正解となります。

入出力例

2
404240022

注記

problem_17171_54bdc9bca5027ba99b1a899532d54824.png

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1222EditorialOpen题解jianglyView

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.