포럼
문제 ICPC00269

E. Exhaustive Experiment

설명

You have been assigned to a new top-secret program involving a strange vacuum system. The physicists working on the system have been trying to find out where it is leaking but now they are confused by all the measurement results and want your help to figure out what is going on.

The vacuum system contains a wall with possibly leaking components. The physicists have performed vacuum leak tests on some of these components by flushing them with helium gas and then noting down whether their mass spectrometer detected any spike in helium in the vacuum system directly following this release of gas. If the component has even the tiniest leak they will detect it this way but there are some complications as well. The helium will rise up and spread out from where they released it and if it passes by any other leaking component, that will also trigger a positive reading. For each unit distance the helium has risen it will also have expanded by one unit. Thus the leak test will produce a positive result if the tested component is leaking or if there is a leaking component above it for which the \(x\) coordinates differs by at most half of the difference in the \(y\) coordinate. See Figure for an example.

You start out with a positive mindset thinking that there are probably just a few leaking components responsible for all the positive measurements. To determine if this is indeed possible you set out to determine the minimum number of leaking components that could give rise to the observed leak test results.

제약
입력 형식

The first line of input contains an integer \(n\) (\(1 \le n \le 2 \cdot 10^5\)), the number of components involved. The following \(n\) lines each contain two integers \(x\) and \(y\) and a character \(c\) (\(-10^8 \le x,y \le 10^8\), \(c \in \{\texttt{-, P, N}\}\)), where \((x, y)\) are the coordinates of a component and \(c\) describes a possible leak test result, with the following meanings:
- '-' – No leak test has been performed on this component
- 'N' – Leak test gave negative response on this component
- 'P' – Leak test gave positive response on this component

No two components have the same position.

출력 형식

Output a single integer, the minimum number of leaking components that could give rise to the observed leak test results. If no set of leaking components could give rise to the observed results, instead output the single word impossible.

예제 1
입력
4
1 -1 P
2 2 P
-1 3 N
-2 -1 -
출력
1
예제 2
입력
2
0 0 N
1 2 P
출력
impossible
문제 정보

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

출처 ICPC NCPC 2020

평가 및 의견

E. Exhaustive Experiment

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

Log in to rate problems.

개별 의견

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

풀이 제출

E. Exhaustive Experiment

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