Building Marble Tracks
시간 제한4초메모리 제한2048 MB
선분을 우선순위가 높은 순서대로 처리하며 이미 선택한 선분과 교차하지 않는 것만 남기고, 남은 선분의 번호를 출력한다.
문제
Jonathan wants you to attach some marble tracks to the wall to play with. Each of them is a straight piece of plastic with a little indent on one side for the marble to roll in. After asking Jonathan how he wants them attached, he spends 15 minutes with some crayons to draw you a blueprint. After he hands it to you, you inform him that you can't build two tracks that intersect at inner points. Jonathan ponders this insight for a moment and then modifies his blueprint. But instead of properly fixing it, he decides to number all tracks from 1 (his most favorite) to n (his least favorite).

The first sample (original blueprint).
It is now your task to figure out which tracks to build. You decide to go through all tracks from his most to least favorite and build them if they do not intersect a track that you have already attached to the wall.
입력
The first line contains one integer () --- the number of marble tracks in the blueprint.
Each of the following lines contains four integers ( and ). These represent a marble track from to in the blueprint.
They are given in order from most to least favorite. Two different tracks intersect in at most one point.
출력
Output one integer in one line, the number of tracks to build. In the next line, output integers, the indices of the tracks to build in increasing order.
힌트
As you might have noticed, the input format specifies for each possible marble track. This is because you can't roll a marble down a vertical track.