포럼
문제 COCI00458

San

설명

Have you ever dreamt that you were the main character in a computer game? The
protagonist of this story, Branimir, is having that dream right now.
The world in Branimir’s dream consists of \(N\) skyscrapers ordered from left to right. For the \(i^{th}\)
skyscraper, we know the height \(H_{i}\) and the number of gold coins \(G_{i}\) on the roof of the
skyscraper. The game begins with a jump on any of the skyscrapers and consists of several
steps. In each step, Branimir can jump on a skyscraper to the right from the one he’s
currently on (it is possible for him to jump over a couple of them too) and if it is not lower
than the current one. On each skyscraper roof he’s on, Branimir will collect all the gold coins.
Branimir can end the game after any number of steps (zero as well), but he must collect at
least \(K\) gold coins in order to advance to the next level.
Branimir wants to know the number of different ways for him to play the game in order to
advance to the next level. Two games are played in different ways if there is a skyscraper
that was visited in one game, and not in the other.

제약

In test cases worth 40% of total points, it will hold \(N \le 20\).

입력 형식

The first line of input contains positive integers \(N\) (\(1 \le N \le 40\)) and \(K\) (\(1 \le K \le 4 \cdot 10^{10}\)), the
numbers from the task.
The \(i^{th}\) of the following \(N\) lines contains two positive integers, \(H_{i}\) and \(G_{i}\) (\(1 \le H_{i}\), \(G_{i} \le 10^{9}\)), the
numbers from the task.

출력 형식

You must output the number of different ways to play the game from the task.

예제 1
입력
4 6
2 1
6 3
7 2
5 6
출력
3
예제 2
입력
2 7
4 6
3 5
출력
0
예제 3
입력
4 15
5 5
5 12
6 10
2 1
출력
4
문제 정보

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

출처 COCI 2017/2018 Contest 2

평가 및 의견

San

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

Log in to rate problems.

개별 의견

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

풀이 제출

San

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