Public submissions
Source code of every submission to this problem in this contest will be visible for everyone since 2014-03-30 20:30:00.
Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

FLAPPY - Flappy Bird (Easy Physics)

Note: there is slight change in constraints, F<G has been removed.

Nawaab is playing flappy bird, there is 2-dimensional map and bird is flying in this map. Here height is positive Y-axis and bird is moving in positive X-axis direction.


Initially bird is at starting point(X=0) and at the height of H meters(Y=H). Bird is moving with some constant velocity and there is no acceleration(or gravity). There are 2 velocities associated with bird one in positive X direction (always 1 meter/sec) and another in negative Y direction or downwards(V meter/s).    


Now there are N obstacles in the path of bird. One obstacle consist of two pillars upper-pillar and lower-pillar and there is some gap between 2 pillars(G meters), in order to pass the obstacle bird had to pass through the gap. The height of i-th lower-pillar is ph[i] meters, distance from origin is d[i] and width is negligible. Note that to pass obstacle bird has to be above lower-pillar and below upper-pillar, it cannot pass by just touching the pillars(i.e. if lower-pillar height is x meters than height of bird while crossing obstacle must be greater than x and less than x+G, it cannot be equal to x or x+G).


Now comes the Role of Nawab, he taps the screen to make bird jump. Whenever nawab taps the screen, bird is displaced by F meters upwards(positive Y direction).Note that tapping does not affect the velocity.     


Your target is find the total number of minimum taps required for each obstacles. Total number of taps required for i-th obstacle is taps done after (i-1)th obstacle and before ith obstacle. If it is impossible to pass an obstacle print "Game Over" and do not print anything after that for further obstacles.


 

INPUT FORMAT:

First line contains V, H, F, G, N.

Then follows N lines (details of N obstacles)

each line of ith obstacle contains two variable d[i] and ph[i].


OUTPUT FORMAT:

output N lines each line containing total number of minimum taps required for ith obstacle.     


CONSTRAINTS:

V,H,F,G,N, d[i], ph[i] are all integers <1000

d[i+1]>d[i].


Example:


INPUT

3 10 5 7 3

10 5

15 30

25 10


OUTPUT

6

8

2



Added by:Himank Agrawal
Date:2014-03-26
Time limit:0.5s-1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM32-GCC ASM64 MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET
Public source code since: 2014-03-30 20:30:00

hide comments
2014-03-29 14:45:32 tarun018


Last edit: 2014-03-29 19:03:15
2014-03-29 12:44:58 Himank Agrawal
Think of all the cases which could lead to Game Over
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.