Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktoptrees · matching · optimization
The organizer’s problem statement is available at the official source link.
tree matching
Pair every city once along unique routes
Each pairing contributes the weighted distance on its unique tree path; find the minimum total over perfect pairings. Schematic structure only; vertices and edges represent the task relation, not an official sample. Schematic graph only; labels and edges show the task relation, not an official sample.
- 1
Pair all cities
Pair all 2n cities exactly once. - 2
Trace unique routes
Trace each pair’s unique path and sum its edge lengths. - 3
Minimize distance
Choose the perfect pairing with the smallest combined route cost.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 charsRun output
Run your code to see output.