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

1276번 - PLATFORME 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 128 MB92039933844.947%

문제

A level is being designed for a new platform game. The locations of the platforms have been chosen. Contrary to popular opinion, platforms can't float in the air, but need pillars for support. More precisely, each of the two ends of the platform needs to be supported by a pillar standing on the floor or on a different platform.

You will be given the locations of the platforms in a coordinate system as in the left image below. Each platform's location is determined by its altitude (vertical distance from the ground) and the start and end coordinates in the horizontal direction. Each support pillar is placed half a unit from the end of a platform, as in the right image.

Determine the total length of pillars needed to support all the platforms.

Example level with three platforms. The lowest platform is at altitude 1, the second lowest at altitude 3 and the third at altitude 5. The total length of pillars needed to support all platforms is 14.

입력

The first line contains the integer N, 1 ≤ N ≤ 100, the number of platforms.

Each of the following N lines contains the position of one platform, three coordinates Y, X1 and X2. The first number is the altitude, the other two the horizontal coordinates. All coordinates will be positive integers less than 10000 satisfying X2 > X1+1 (i.e. the length of each platform will be at least 2).

The input will be such that no two platforms overlap.

출력

Output the total length of pillars needed to support all the platforms.

제한

예제 입력 1

3
1 5 10
3 1 5
5 3 7

예제 출력 1

14

예제 입력 2

5
50 50 90
40 40 80
30 30 70
20 20 60
10 10 50

예제 출력 2

200

힌트

출처

Olympiad > Croatian Highschool Competitions in Informatics > 2008 > Croatian Regional Competition in Informatics 2008 1번

Olympiad > Croatian Highschool Competitions in Informatics > 2008 > Regional Competition - Seniors 2번

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

출처

대학교 대회

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

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