Elapid Errands

시간 제한11초메모리 제한1024 MB

요약
맨해튼 거리가 20 이상인 무작위 점 20개를 순서대로 지나가면서 같은 칸을 두 번 밟지 않는 격자 경로를 찾는다.
난이도

어려움10점 중 8점

유형
구현, 시뮬레이션, 그리디, 기하
정답자
아직 제출이 없습니다

문제

Carl the snake is in his burrow at the point (0,0)(0,0) in an infinite plane. He wants to visit the points (x_1,y_1),(x_2,y_2),…,(x_N,y_N)(x\_1, y\_1), (x\_2, y\_2), \dots, (x\_N, y\_N). These points must be visited in the order they are given, and Carl must end up at the point (x_N,y_N)(x\_N, y\_N). In one move, he can move one step up, down, left, or right. However, since he is a very long snake, he can never visit the same point more than once.

Your task is to find a sequence of moves such that Carl visits all the points in order, and never visits any point more than once. The points (x_i,y_i)(x\_i, y\_i) were generated uniformly at random.

입력

The first line contains one integer NN (1≤N≤201 \leq N \leq 20), the number of points you must visit.

The following NN lines each contain two integers x_i,y_ix\_i, y\_i (0≤x_i,y_i≤1040 \leq x\_i, y\_i \leq 10^4).

Apart from the sample, there will be 100100 testcases, all with N=20N = 20. The (manhattan) distance between any two of the points (including the starting point (0,0)(0,0)) will be at least 2020. Within these constraints, the points (x_i,y_i)(x\_i, y\_i) were generated uniformly at random.

Note that the sample does not satisfy the distance requirement. Your solution does not need to solve the sample to get accepted.

출력

Print a string consisting of the characters '<', '>', '^', 'v'. This is the list of moves you should make so that you visit all the points in order without ever going to the same point more than once. The string must have length at most 2⋅1062 \cdot 10^6.

예제1

  1. 예제 1

    입력
    2
    0 10
    5 0
    
    예상 출력
    ^^^^^^^^^^>>vvv>v>vvv<vvv>>