Apollonian Network
Time limit3sMemory limit512 MB
Given a weighted Apollonian network with n vertices, find the largest total edge weight of any simple path in the graph.
- Level
Hard9 of 10
- Topics
- Graph, Dynamic programming, Recursion
- Solved
- No attempts yet
Problem
An Apollonian network is an undirected graph. It starts from a triangle, and then repeatedly takes a triangle in the middle and splits it into three smaller triangles.

In a weighted Apollonian network, find the simple path with the largest total weight, and print that total weight.
Input
The first line contains the number of vertices ().
The next lines each contain three integers , , . Each line means that an edge with weight connects vertices and . (, )
The given graph is an Apollonian network.
Output
Print the largest total weight of a simple path.