포럼
문제 ICPC00173

C. Cleaning Pipes

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

Linköping has a quite complex water transport system. Around Linköping there are several wells from which water is drawn. The water is then transported to other locations using pipes. Each pipe is a straight canal from one of the wells to some location in the city.

All the pipes are at the same depth under ground. Therefore, whenever two pipes cross, they form an intersection. Luckily the pipe system was constructed in such a way that exactly two pipes meet at each such intersection. The wells do not count as intersections. Any number of pipes (including zero or more than two) may originate at each well.

The intersections pose a problem, since dirt (a mixture of lime and other "remains") tends to get stuck there. This dirt causes the pipes to degrade and collapse, leading to the formation of large sink holes. Such sink holes have a mesmerising effect on the students in Linköping, causing them to neglect their studies and remain uneducated, which in the long run will lead to a collapse of not just the pipe system but of the very fabric of society. Therefore it is imperative that the pipes are regularly cleaned. The Nordic Water Extraction and Redistribution Company (NWERC) – which is in charge of Linköping's waterpipes – has an ample fleet of robots to perform this task. A robot can be inserted into a pipe at the well where the pipe begins. The robot then goes through the pipe all the way to its end and cleans all intersections along the way. After reaching the end, the robot turns around and returns back to the well where it started. In order to prevent robot collisions, government regulations stipulate that whenever two pipes intersect, at most one of them may contain a robot.

Since the whole water system has to be shut down while it is being cleaned (another government regulation), the NWERC would like to do the cleaning quickly, by using a single batch of cleaning robots, all started at the same time.

Your task is to verify whether this can be done – i.e., whether we can simultaneously insert robots into a subset of the pipes in such a way that the robots will clean all intersections and there will be no risk of two robots colliding.

제약
입력 형식

The input consists of:
- one line with two integers \(w\) (\(1 \le w \le 1\,000\)), the number of wells, and \(p\) (\(1 \le p \le 1\,000\)), the number of pipes;
- \(w\) lines, the \(i\)th of which contains two integers \(x_i\) and \(y_i\) (\(-10\,000 \le x, y \le 10\,000\)), the position of well number \(i\) (the wells are numbered from \(1\) to \(w\));
- \(p\) lines each with three integers \(s\) (\(1 \le s \leq w\)), the well at which the pipe starts, and \(x\) and \(y\) (\(-10\,000 \le x, y \le 10\,000\)), the position at which the pipe ends.

Each pipe will contain exactly one well, the one at which it starts. Any point shared by more than two pipes will be a well. Any two pipes share at most one common point. The common point of two pipes may be the endpoint of one or both of them. All pipes have positive length.

출력 형식

If it is possible to clean all intersections as described above, output "possible". Otherwise, output "impossible".

예제 1
입력
3 3
0 0
0 2
2 0
1 2 3
2 2 2
3 0 3
출력
impossible
예제 2
입력
2 3
0 0
0 10
1 5 15
1 2 15
2 10 10
출력
possible
문제 정보

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

출처 ICPC NWERC 2015

평가 및 의견

C. Cleaning Pipes

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

Log in to rate problems.

개별 의견

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

풀이 제출

C. Cleaning Pipes

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