OGRADA | 프로그래밍의 벗 PivotOJ
PivotOJ

OGRADA

시간 제한: 1000ms메모리 제한: 128MB출처: CHC 2009 Final Exam #1BOJ 3119
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

Mirko built a wooden fence next to his house. He built his fence by slamming rectangular wooden boards into the ground. For each board we know its height, width and distance of its left edge from Mirko's house. 

Mirko was really enjoying building his fence, so much that he stopped paying attention as to how he was building it – now that he is done, some of the boards are overlapping, and there are holes in the fence, total chaos! 

Mirko is now looking at his fence and is shocked – he could have built a fence the same fence (when looked from up front) using fewer boards. If we connect the top sides of all boards as in the image below, we get the skyline of the fence. 

[이미지 1]

The second example input. The skyline is depicted by a bold line. 

Mirko decided to remove some of the boards from the fence so that the skyline remains the same and that as few boards as possible remain in the fence. 

Write a program that determines which boards should remain in the fence. 

입력

The first line contains an integer N (1 ≤ N ≤ 100 000), the number of boards initially in Mirko's fence. Each of the following N lines describes one board with three integers X, W and H; these are the distance of the left edge of the board from Mirko's house, width and height of the board, respectively. No two boards will share the same (X, W, H) triplet. All these numbers will be at most a billion (109). 

Boards are numbered 1 to N. 

출력

On the first line output B, the smallest number of boards that need to remain for the skyline to stay the same. 

On the second line output B integers separated by spaces, the numbers of boards that should remain in the fence. This part of the output is not necessarily unique. 

예제

예제 1

입력
5
10 11 30
19 1 20
15 9 10
7 7 20
3 12 40
출력
3
1 3 5

예제 2

입력
6
15 8 4
10 8 3
25 3 7
3 9 5
1 5 3
7 2 2
출력
5
1 2 3 4 5
코드를 제출하려면 로그인하세요.