Type: Default 1000ms 256MiB

迷宫的所有路径

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

已知一N×N 的迷宫,允许往上、下、左、右四个方向行走,且迷宫中没有任何障碍,所有的点都可以走。

现请你按照右、下、左、上顺序进行搜索,找出从左上角到右下角的所有路径。

Format

Input

输入一个整数 N(2≤N≤5)代表迷宫的大小。

Output

按右、下、左、上搜索顺序探索迷宫,输出从左上角 (1,1) 点走到右下角 (N,N) 点的所有可能的路径。

Samples

3
1:1,1->1,2->1,3->2,3->3,3
2:1,1->1,2->1,3->2,3->2,2->3,2->3,3
3:1,1->1,2->1,3->2,3->2,2->2,1->3,1->3,2->3,3
4:1,1->1,2->2,2->2,3->3,3
5:1,1->1,2->2,2->3,2->3,3
6:1,1->1,2->2,2->2,1->3,1->3,2->3,3
7:1,1->2,1->2,2->2,3->3,3
8:1,1->2,1->2,2->3,2->3,3
9:1,1->2,1->2,2->1,2->1,3->2,3->3,3
10:1,1->2,1->3,1->3,2->3,3
11:1,1->2,1->3,1->3,2->2,2->2,3->3,3
12:1,1->2,1->3,1->3,2->2,2->1,2->1,3->2,3->3,3

Limitation

1s, 1024KiB for each test case.

3.1

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
10
Start at
2025-2-28 17:15
End at
2025-3-21 13:15
Duration
500 hour(s)
Host
Partic.
4