#P4704. 太极剑
太极剑
Description
After learning Taiji, Bob asks Alice to teach him the Taiji Sword. Alice tells him he must first pass a basic swordsmanship test. The test requires Bob to cut ropes as quickly as possible.
All rope endpoints are pairwise distinct, so there are endpoints in total. These endpoints are tied on a circle, evenly spaced. We number these endpoints clockwise from to .
Each of Bob’s cuts is a straight line, and it severs every rope that intersects this line. He wants to know the minimum number of cuts needed to cut all the ropes.
Input Format
The first line contains an integer , representing the number of ropes.
The next lines each contain two integers , indicating the indices of the two endpoints of the -th rope.
Output Format
Output a single integer, the answer.
2
1 2
3 4
1
3
1 2
3 4
5 6
2
3
1 3
2 4
5 6
1
Hint
Explanation for Sample 1: 
Explanation for Sample 2: 
Explanation for Sample 3: 
Translated by ChatGPT 5
京公网安备 11011102002149号