시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 146 55 45 35.433%

문제

농부 존과 그의 소들은 프리스비를 하며 놀고 있다. 베시가 프리스비를 던지자, 마크한테 갔고 결국 마크네 팀에게 프리스비가 넘어갔다! 마크의 키는 H이고(1 <= H <= 1,000,000,000), 마크 근처에 있는 베시네 팀원은 N명 있다 (2 <= N <= 20). 마크가 던지는 프리스비를 뺏기 위해서는 마크보다 키가 크거나 같아야한다. 소 여러 마리가 하나의 스택을 쌓아 키를 높여도 된다. 각 소 마다 키, 무게와, 힘이 정해져 있다. 소의 힘이란 소가 들 수 있는 무게를 말한다.

이러한 조건이 주어졌을 때, 베시는 그녀의 팀이 마크의 프리스비를 뺏을 수 있는지 궁금해졌다. 만약 가능하다면, 최대로 안정된 정도를 원한다. 여기서 안정된 정도란 쌓은 스택의 맨 위에 추가로 더 올릴 수 있는 무게를 의미한다.

입력

입력의 첫 줄에는 N과 H가 주어진다.

다음 N개의 줄에 각 소의 키, 무게, 힘이 주어진다. 입력으로 주어지는 모든 수는 10억보다 크지 않은 자연수이다.

출력

베시네 팀이 마크의 프리스비를 뺏을 수 있다면, 최대의 안정된 정도를 출력한다. 만약 뺏을 수 없다면, "Mark is too tall"를 출력한다. (따옴표 제외)

예제 입력 1

4 10
9 4 1
3 3 5
5 5 10
4 4 5

예제 출력 1

2
W3sicHJvYmxlbV9pZCI6IjEwNjQ5IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVkNTA0XHViOWFjXHVjMmE0XHViZTQ0IiwiZGVzY3JpcHRpb24iOiI8cD5cdWIxOGRcdWJkODAgXHVjODc0XHVhY2ZjIFx1YWRmOFx1Yzc1OCBcdWMxOGNcdWI0ZTRcdWM3NDAgXHVkNTA0XHViOWFjXHVjMmE0XHViZTQ0XHViOTdjIFx1ZDU1OFx1YmE3MCBcdWIxODBcdWFjZTAgXHVjNzg4XHViMmU0LiBcdWJjYTBcdWMyZGNcdWFjMDAgXHVkNT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HVjNWI0In1d

출처

Olympiad > USA Computing Olympiad > 2014-2015 Season > USACO December 2014 Contest > Gold 1번

  • 문제를 번역한 사람: myungwoo
  • 잘못된 번역을 찾은 사람: suhgyuho