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

25842번 - Tetrooj Box 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 1024 MB49464193.182%

문제

Dr. Orooji’s children have played Tetris but are not willing to help Dr. O with a related problem. Dr. O’s children don’t realize that Dr. O is lucky to have access to 100+ great problem solvers and great programmers today!

Dr. O knows the length of the base for a 2D box and wants to figure out the needed height for the box. Dr. O will drop some 2D blocks (rectangles) on the base. A block will go down until it lands on the base or is stopped by an already-dropped block (i.e., it lands on that block). After all the blocks have been dropped, we can determine the needed height for the box – the tallest column is the needed height (please see pictures on the next page corresponding to Sample Input/Output).

입력

The first input line contains two integers: b (1 ≤ b ≤ 100), indicating the length of the base and r (1 ≤ r ≤ 50), indicating the number of blocks (rectangular pieces) to be dropped. Each of the next r input lines contains three integers: a block’s horizontal length h (1 ≤ h ≤ 100), the block’s vertical length v (1 ≤ v ≤ 100), and c (c ≥ 1), the leftmost column the block is dropped into. Assume that the h and c values will be such that the block will not go beyond the box base, i.e., (c + h – 1) ≤ b.

출력

Print the needed height for the box (the tallest column is the height).

제한

예제 입력 1

10 4
2 3 1
4 2 2
1 7 6
1 3 4

예제 출력 1

8

예제 입력 2

10 3
3 4 8
8 2 1
1 1 3

예제 출력 2

7

힌트

First Sample Input/Output:

Second Sample Input/Output:

출처

University > University of Central Florida > 2020 Local Programming Contest (Round 1B) 3번

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

출처

대학교 대회

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

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