#P2610. [ZJOI2012] 旅游
[ZJOI2012] 旅游
Description
During the rare summer vacation, to celebrate Xiaobai’s excellent performance in the math exam, Xiaolan decides to take Xiaobai on a trip~~
After some deliberation, they choose Country T as their destination. The territory of Country T can be represented by a convex -gon, and the vertices represent entry/exit ports. Country T contains cities, each city being a triangle whose vertices are vertices of the -gon (in other words, the cities form a triangulation of Country T). The travel route of the two can be regarded as a line segment connecting two non-adjacent vertices among the vertices.

To buy the best souvenirs, Xiaobai hopes the route passes through as many cities as possible. As Xiaolan’s friend, can you help?
Input Format
Each input file contains only one test case.
The first line contains a positive integer , as described above.
Then there are lines. Each line contains three integers , indicating the vertex indices of that city’s triangle (the vertices of Country T are numbered from to in clockwise order).
Output Format
Output a single line: the maximum number of cities that can be passed through. (A city is counted as passed if and only if it shares at least two common points with the route.)
6
1 2 4
2 3 4
1 4 5
1 5 6
4
Hint
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号