Traveling Salesman Problem
시간 제한1초메모리 제한256 MB
이동 시간이 |dx + dy|일 때, 1번 도시에서 출발해 모든 도시를 한 번씩 방문하고 돌아오는 최소 시간을 구한다.
문제
There are cities numbered from to , the -th of which is at coordinates .
Busy Beaver wants to start at city , visit every city exactly once, and return to city .
To go from city to city , it takes seconds. Find the minimum number of seconds for Busy Beaver to complete his trip.
입력
The first line contains a single integer () --- the number of test cases.
The first line of each test case contains a single integer () --- the number of cities.
The -th of the next lines of each test case contains two integers and () --- the coordinates of the -th city.
The sum of across all test cases does not exceed .
출력
For each test case, output a single integer --- the minimum number of seconds needed for Busy Beaver to complete his trip.
힌트
In the first test case, we can take the path which takes seconds.
