Universal Cup Judging System

Universal Cup

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

문제 설명

$n \ge 1$이라 합시다. 세 쌍의 평행선 묶음을 그어 큰 삼각형을 $n^2$개의 작은 삼각형으로 나누는 다음과 같은 표준적인 방법을 생각해 봅시다:

problem_17171_1.png

자연스럽게 이는 $(n + 1)(n + 2)/2$개의 정점과 $3n(n + 1)/2$개의 간선을 가지는 무방향 그래프를 정의합니다. 정점은 격자의 노드, 즉 선분들의 교점(그림에서 굵게 표시된 점)이며, 간선은 인접한 노드 사이의 선분입니다. 당신의 과제는 삼각형의 가장 위쪽 정점에서 "시작하는" 이 그래프의 간선 위에서의 오일러 회로를 구성하는 것입니다. 다시 말해, 가장 위쪽 정점에서 출발하여 간선을 따라 이동하면서 각 간선을 정확히 한 번씩 지나고 마지막에 가장 위쪽 정점으로 돌아와야 합니다. 해가 항상 존재함을 증명할 수 있습니다.

입력

$1$ 이상 $20$ 이하의 정수 $n$이 주어집니다.

출력

그래프의 어떤 오일러 회로를 나타내는, $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.