High Jump
Practice
4.6 (11 votes)
Sorting
Algorithms
Easy Medium
Sorting
Problem
93% Success 12457 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

There's a line of \(L\) meters. You need to start at \(0\), and arrive \(L\). There are \(N\) obstacles on the line. Each obstacle has a position \(p_i\) and height \(h_i\).

You have two ways to move, first one - just walk towards the destination, second one - jump to avoid obstacles.

If you are \(X\) meters far from the start point, and \(Y\) meters high, we say you are at \((X,Y)\). A jump means, start from \((X,0)\), travel along the line \((X,0)-(X+\frac{Y}{A},Y)\) and then \((X+\frac{Y}{A},Y)-(X+\frac{2Y}{A},0)\), which \((X,0)\) is the start position of the jump, and \(Y\) is the height of the jump. If one of the two lines pass through any obstacle, this jump is illegal (It's legal to pass through the highest point of a obstacle). The height \(Y\) is decide by yourself, but it should less than \(M\). \(A\) is your rising speed and falling speed.

Arrive \(L\) means, your position should be (L,0) at some time.

You need to determine if it's possible to arrive \(L\).

Input Format

First line contains four integers, \(N,M,L,A(1\le N\le 10^5,1\le M,L,A\le 10^9)\).

The \((i+1)\) th line contains two integers, \(p_i,h_i(1\le p_i<L,1\le h_i\le 10^9)\).

Output Format

"Yes" or "No".

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
13 votes
Tags:
SortingAlgorithmsAdvanced SortingGreedy Algorithms
Points:30
4 votes
Tags:
Ad-HocRecursionSortingEasy-Medium
Points:30
3 votes
Tags:
AlgorithmsEasy-MediumSorting