All submissions for this problem are available.
Chef Ash wants a new game. He has created his own spin-off of a Bowling Alley.
He takes a rectangular area of edge mxn. This rectangle has mxn cells in it. Each cell may have either a bumper or a bowling pin.
The ball may be rolled in any of the Four directions(input uses this notation 0=north, 1=east, 2=south, 3=west,) with any speed. Calculate the points scored subject to the following rules:
1) Every bowling pin dropped, reduces the ball's speed by 1
2) When the ball hits a bumper, it's speed reduces by 1.5 and it changes direction to the right of the direction it was originally travelling in.
3) If the ball hits the edge of the rectangle, it rebounds back in the opposite direction with the same velocity.
4) The Bowling Pin falls, only the first time the ball passes through that cell.
5) Each Bowling Pin is worth 1 point. Each Bumper is assigned a set of points for its worth.
6)If there's no pin or bumper in the cell, the ball speed reduces by 0.5 .
The first line contains the horizontal length (n), vertical length (m) of the rectangle ,the number of bumpers (q) and number of balls(w). (n m q w)
The next q lines take the space separated input of the location of bumpers and their points. (X Y Points)
The next w lines take a space separated input of location of balls, starting direction and speed. (X Y DIRECTION SPEED)
The w balls are played sequentially after resetting the Alley at the end of the last ball.
Only speed is taken as float value, rest all data type is integer type.
The score of each ball on a new line (totally w lines).
Input: 5 4 5 3 1 0 2 0 3 1 4 3 3 3 2 1 2 1 2 3 3 0 20 4 3 3 25 1 0 0 10 Output: 13 25 10
|Time Limit:||0.210526 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.