RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
ICPC00042

K. Surveillance

Unrated 레이팅 미적용
난이도
4s
시간 제한
1024MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

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\) and \(k\) (\(3 \le n \le 10^{6}\) and \(1 \le k \le 10^{6}\)), where \(n\) is the number of walls and \(k\) is the number of possible places for installing cameras. Each of the remaining \(k\) lines contains two integers \(a_{i}\) and \(b_{i}\) (\(1 \le a_{i}\), \(b_{i} \le n\)). These integers specify which walls a camera at the \(i^{th}\) place would cover. If \(ai \le bi\) then the camera covers each wall \(j\) such that \(ai \le j \le bi\). If \(ai > bi\) then the camera covers each wall \(j\) such that \(ai \le j \le n\) or \(1 \le j \le bi\).

출력 형식

Display the minimal number of cameras that suffice to cover each wall of the building. The ranges covered by two cameras may overlap. If the building cannot be covered, display impossible instead.

예제 1
입력
100 7
1 50
50 70
70 90
90 40
20 60
60 80
80 20
출력
3
예제 2
입력
8 2
8 3
5 7
출력
impossible
예제 3
입력
8 2
8 4
5 7
출력
2
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC World Finals 2014

평가 및 의견

K. Surveillance

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

K. Surveillance

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8