目录
题目
题目描述
The International Corporation for Protection and Control (ICPC) develops efficient technology for, well, protection and control. Naturally, they are keen to have their own headquarters protected and controlled. Viewed from above, the headquarters building has the shape of a convex polygon. There are several suitable places around it where cameras can be installed to monitor the building. Each camera covers a certain range of the polygon sides (building walls), depending on its position. ICPC wants to minimize the number of cameras needed to cover the whole building.
输入格式
The input consists of a single test case. Its first line contains two integers n n n and k k k ( 3 ≤ n ≤ 1 0 6 3 \le n \le 10^6 3≤n≤106 and 1 ≤ k ≤ 1 0 6 1 \le k \le 10^6 1≤k≤106), where n n n is the number of walls and k k k is the number of possible places for installing cameras. Each of the remaining k k k lines contains two integers a i a_ i ai and b i b_ i bi ( 1 ≤ a i , b i ≤ n 1 \le a_ i, b_ i \le n 1≤ai,bi≤n). These integers specify which walls a camera at the i t h i^{th} ith place would cover. If