Max Pair Matching
시간 제한1초메모리 제한1024 MB
2n개의 정수 쌍이 주어질 때, 각 간선의 가중치를 두 쌍의 경계 상자 사이의 체비쇼프 거리로 정의하고 완전 매칭의 최대 총 가중치를 구한다.
문제
You are given pairs of integers. Consider a complete graph on vertices and define the weight of the edge to be .
Determine the maximum weight of the matching in this graph.
In other words, consider all ways to select edges of this graph such that no two chosen edges have a common endpoint. What is the maximum possible total weight of these edges?
입력
The first line of the input contains a single integer ().
The -th of the next lines contain two integers and ().
출력
Print a single integer --- the maximum weight of the matching in this graph.
힌트
Adjacency matrix: