Back
Close

Thermal Flying - Episode 1

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 :
. means there is no thermal activity
V pilot position (no thermal activity on this position)
-9 to 9 thermal value

Here we consider our paraglider vertical speed is -1m/s and horizontal speed is 10m/s, it goes from left to right
the y step of the grid is 1 meter
the x step of the grid is 10 meters

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 4 2
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
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

Tags
ParsingLoopsSimulation

Difficulty
Medium

Test cases
Morning Flight Test
Input
23 10 6 ....................... ....................... V...................... ....................... ....................... ....................... ....................... ....................... ....................... .......................
Output
6 1

Validator 1 Validator
Input
23 10 7 ....................... ....................... V...................... ....................... ....................... ....................... ....................... ....................... ....................... .......................
Output
7 0

Little thermal Test
Input
15 11 8 ...1111111..... V...11111...... ....1111....... .....111....... .....11........ .....11........ .....11........ ....1111....... ...111.11...... ..11.1...1..... .1111111111....
Output
8 3

Validator 2 Validator
Input
15 11 6 ...1111111..... V...11111...... ....1111....... .....111....... .....11........ .....11........ .....11........ ....1111....... ...111.11...... ..11.1...1..... .1111111111....
Output
6 5

Bigger thermal Test
Input
20 10 12 ....22222111........ V..11222111......... ....122211.......... ....112211.......... .....1221........... .....12211.......... .....121............ .....111............ ......11............ ....11111...........
Output
12 2

Validator 3 Validator
Input
20 10 10 ....22222111........ V..11222111......... ....122211.......... ....112211.......... .....1221........... .....12211.......... .....121............ .....111............ ......11............ ....11111...........
Output
10 4

Strong one with downdraft Test
Input
27 9 15 V....121.....1111-1-1........ ....11211111111-1-1.......... ....111112321-1-1............ .....11123333-1-1............ .......1233323-1............ .......1232221-1............ .........1333-1............. .........1221.............. ........122211.............
Output
15 1

Validator 4 Validator
Input
27 9 16 V....121.....1111-1-1........ ....11211111111-1-1.......... ....111112321-1-1............ .....11123333-1-1............ .......1233323-1............ .......1232221-1............ .........1333-1............. .........1221.............. ........122211.............
Output
16 0

Turbulent air Test
Input
30 10 17 ..1111111111111..............1 ...111331111.......1.....11111 V...111211-1.......11...1121111 ....111211......1221....11-21.. .......12-21.....1-311..11111... .......1111.....1.......-11.... ........1111...1211.....-111... .......11-11.111211...1111..... ....133112..111..122311..1111. ..11111111222...22111111....1.
Output
17 2

Validator 5 Validator
Input
30 10 20 ..1111111111111..............1 ...111331111.......1.....11111 V...111211-1.......11...1121111 ....111211......1221....11-21.. .......12-21.....1-311..11111... .......1111.....1.......-11.... ........1111...1211.....-111... .......11-11.111211...1111..... ....133112..111..122311..1111. ..11111111222...22111111....1.
Output
20 4

Cumulonimbus Test
Input
30 10 17 144412333848866854449999933339 ..1556666556666644999999999999 ...1122333666188888889999999.. .......555199913333366........ ...........18815555........... V...........111156221......... ........111155555888111111.... ...1112233366662221111111..... .11111255555.55222222221111111 111111111111111111111111111111
Output
13 8

Validator 6 Validator
Input
30 10 19 144412333848866854449999933339 ..1556611111111111111111199999 ...1122333611111118889999999.. .......555199913333366........ ...........18815555........... V...........111156221......... ........111155555888111111.... ...3112233366662221111111..... .11111255555.55222222221111111 111111111111111111111111111111
Output
17 8

Apocalyptic Test
Input
30 8 26 5-21266-5629-2.134531..-81622..... 541061605-01656846-8465151986016 V18...1681-688.61....68681-61616 7.21562-325516843413.1.6886.668 12-115135884-6984494984949808909 1215-86-681153-236666-668949-849888 6848-74-98-686...6516-6848452-55-258 111231513588-55318-88944-48494848
Output
2 2

Validator 7 Validator
Input
30 8 26 5-21266-5629-2.134531..-81622..... 541061605-01656846-8465151986016 V18...1681-688.61....68681-61616 7321562-325516843413.1.6886.668 1.-115135884-6984494984949808909 1215-86-681153-236666-668949-849888 6848-74-98-686...6516-6848452-55-258 111231513588-55318-88944-48494848
Output
4 5

Solution language

Solution

Stub generator input