A higher resolution is required to access the IDE
- 38
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
The air above us is not stable, there is a lot of movement and turbulences.Paraglider pilots use something called thermals to gain altitude.
You have to simulate the flight of a pilot and give its position at a certain time t.
The simulation area is represented by a 2D grid :
Here we consider our paraglider vertical speed is
the y step of the grid is
the x step of the grid is
If the paraglider pilot happen to be in a thermal, its altitude is increased (or decreased) by the thermal value.
If the pilot leaves the grid, you stop the simulation and print its last recorded position.
Warning ! The grid coordinates doesn't use the CG standards
It will be in normal representation, like this :
2 . . .
1 . . .
0 1 2 3
Example: for width = 5, height = 4, t = 4
V . . . .
. . . 1 .
. . 2 . .
. . . . .
then
. . . . .
. V . 1 .
. . 2 . .
. . . . .
then
. . V . .
. . . 1 .
. . 2 . .
. . . . .
then
. . . V .
. . . 1 .
. . 2 . .
. . . . .
then
. . . . .
. . . 1 V
. . 2 . .
. . . . .
position at t is
Input
line 1 : width grid width
line 2 : height grid height
line 3 : t the duration of the simulation
following lines: a string that give the thermal conditions
line 2 : height grid height
line 3 : t the duration of the simulation
following lines: a string that give the thermal conditions
Output
the simulated position x y of the pilot at time t
Constraints
0 ≤ t ≤ 99
Example
Input
23 10 6 ....................... ....................... V...................... ....................... ....................... ....................... ....................... ....................... ....................... .......................
Output
6 1
A higher resolution is required to access the IDE