RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00285

Odašiljači

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(3^{rd}\) round, December \(7^{th}\), 2013

The mayor has decided that it is high time to implement a new system of television transmitters. The
city can be represented as a segment of the length D on which there are buildings of different
heights. The width of a building is negligible. On top of some buildings, television transmitters are
set, their dimensions are also negligible.

Television transmitters emit a television signal in all directions around them. The signal is spread
through space in straight lines and cannot pass through buildings. A certain point in the city is
considered covered if it is reached by a signal from an existing transmitter.

Find the segment of the city covered by television signal and output its length.

제약

In test cases worth 30% of total points, N will be less or equal to 1000.

입력 형식

The first line of input contains the integer N (\(1 \le N \le 3 \cdot 10^{5}\)), the number of buildings, and the
integer D (\(1 \le D \le 10^{9}\)), the city length.
Each of the following N lines contains three numbers which describe the i^{th} building:
1. a number which determines whether there is a transmitter on top of the building: 0 (no) or 1
(yes)
2. an integer X_{i} (\(0 \le X_{i} \le D\)), the distance between the building and the left end of the city
3. an integer H_{i} (\(1 \le H_{i} \le 10^{9}\)), the building height
The buildings are sorted in ascending order by the distance from the left end of the city. No two
buildings will be located on the same distance from the left end of the city.

출력 형식

The first and only line of output must contain the required length from the text.
Note: the maximum permissible deviation from the official solution is \(10^{-3}\).
\(3^{rd}\) round, December \(7^{th}\), 2013

예제 1
입력
3 10
1 2 6
0 4 3
0 8 2
출력
6.000000
예제 2
입력
5 15
0 4 3
1 5 5
1 6 6
0 9 2
0 10 3
출력
8.500000
설명

Clarification of the second example: This example corresponds to the image from the text. The
image depicts the city. The buildings are marked with vertical lines, and the transmitters with circles on
the tops of the buildings. The bold lines on the x-axis represent the segment of the city not covered by
television signal.

문제 정보

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

출처 COCI 2013/2014 Contest 3

평가 및 의견

Odašiljači

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

Log in to rate problems.

개별 의견

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

풀이 제출

Odašiljači

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