Logo
(追記) (追記ここまで)

8289번 - Exam 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 128 MB646619.355%

문제

Byteasar has recently started his PhD studies. He researches and teaches. The first semester is over. Students wrote their exam and now Byteasar has to grade it.

Each student produced one sheet of size A × B millimetres. According to the advice by his elder colleagues Byteasar applied the standard university procedure. He grabbed all the sheets and threw them to the air. The sheets fell onto the ground. To his surprise, the sheets arranged themselves parallel to the walls of his rectangular office. The exam will be passed by the students whose sheets are on the top.

A sheet is on the top if none of its inner points is covered by another sheet. In particular, this means that sides of the sheet may be covered.

Write a program to check who passed the exam.

입력

The first line of input contains three integers n, A and B (1 ≤ n ≤ 100,000, 1 ≤ A, B ≤ 109) denoting respectively the number of sheets and the dimensions of each sheet in millimetres. Sheets are rectangles with sides parallel to the axes.

The following n lines describe sheets in order of their fall to the floor. The description of one sheet is composed of three integers xi, yi, ri (-109 ≤ xi, yi ≤ 109, ri ∈ {0, 1}). Point (xi, yi) is the lower left corner of the sheet. If ri = 0, then the sheet is a rectangle of height A and width B, but when ri = 1, the height is B and width A.

출력

The first line of the output should contain one integer k equal to the number of sheets that are not covered (except for their sides) by other sheets. The second line should hold a sequence numbers of those sheets in increasing order. The sheets are numbered 1 through n as they appear in the input.

제한

예제 입력 1

4 3 2
1 1 0
3 2 0
6 2 0
4 3 1

예제 출력 1

2
1 4

힌트

출처

Contest > Algorithmic Engagements > PA 2011 7-3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /