A higher resolution is required to access the IDE
- 17
Statement
Goal
Bricks ofThe ball will bounce off of:
- The left, right, and top of the playfield
- Any side of any brick
- The top of a
All bounces are treated classically. The accidental angle is equal to the incidental angle. So, for example, if the ball's vector is (vX, vY) = (
You don't need to worry about what happens if the ball hits the corner of something. The tests are engineered to avoid this situation.
Each brick has an associated kStrength value, indicating the "strength" of the brick. A brick with a strength of
For many of the tests, the paddle is stationary, but in some of the latter tests, the paddle can move around the playfield to keep the ball in play. Multiple coordinate sets are provided to specify the various locations of the paddle throughout the test. The paddle "moves" to the next coordinate set after being hit by the ball. If there are no other coordinate sets provided in the input, then the paddle doesn't move for the rest of the test, and remains at the last specified position.
The ball is lost if it goes off the bottom of the playfield. Your program must calculate and report points acquired by breaking bricks before the ball is lost.
Input
Line 1: Two space-separated integers bX and bY indicating the starting position of the ball.
Line 2: Two space-separated integers vX and vY indicating the starting vector of the ball.
Line 3: An integer pN indicating the number of positions that will be occupied by the paddle during the game.
Line 4: An integer kN indicating the number of bricks initially on the playfield.
Next pN lines: Two space-separated integers pX and pY for the coordinates of the top-left-hand pixel of the paddle.
Next kN lines: Four space-separated integers kX, kY, kStrength, kPoints for the coordinates of the top-left corner of the brick, the strength of the brick, and the number of points earned for breaking the brick.
Line 2: Two space-separated integers vX and vY indicating the starting vector of the ball.
Line 3: An integer pN indicating the number of positions that will be occupied by the paddle during the game.
Line 4: An integer kN indicating the number of bricks initially on the playfield.
Next pN lines: Two space-separated integers pX and pY for the coordinates of the top-left-hand pixel of the paddle.
Next kN lines: Four space-separated integers kX, kY, kStrength, kPoints for the coordinates of the top-left corner of the brick, the strength of the brick, and the number of points earned for breaking the brick.
Output
The number of points earned before the ball is lost.
Constraints
0≤bX<1600
0≤bY<2400
-100≤vX≤100
-100≤vY≤100
1≤pN≤32
1≤kN≤64
0≤pX≤1400
2200≤pY≤2300
0≤kX≤1500
0≤kY≤1500
1≤kStrength≤5
0≤bY<2400
-100≤vX≤100
-100≤vY≤100
1≤pN≤32
1≤kN≤64
0≤pX≤1400
2200≤pY≤2300
0≤kX≤1500
0≤kY≤1500
1≤kStrength≤5
Example
Input
100 100 0 100 1 1 1400 2300 1500 0 1 1
Output
0
A higher resolution is required to access the IDE