Level 3
u too? [Link]/career
#WeLoveSoftware
LEVEL 3
#WeLoveSoftware
u too? [Link]/career
LEVEL 3
It’s your turn to steer the spaceship
▪ You are given a list of space stations
▪ Steer your spaceship to each space station
▪ Space is 1-dimensional
▪ For each space station:
− Your spaceship starts at position 0
− Generate a movement sequence
− Your spaceship must reach the position of the station exactly
− A time limit is given
− The sequence must complete within the time limit
− The time limit is very generous; you don’t need a fast solution!
▪ Allowed paces are explained on the next slide
LEVEL 3
LEVEL 3
Paces
▪ There are limitations on how your spaceship can move
▪ Each sequence must start and end with pace 0
▪ The slowest pace is 5 or -5
▪ The fastest pace is 1 or -1
▪ Your spaceship can only gradually step up the pace as well as step down
-1 ⇆ -2 ⇆ -3 ⇆ -4 ⇆ -5 ⇆ 0 ⇄ 5 ⇄ 4 ⇄ 3 ⇄ 2 ⇄ 1
LEVEL 3
LEVEL 3
Input
Name Description Example
N Number of cases 3
2 25
Space station 5 39
and time limit The position of the space station and the time limit separated by a space -7 46
(repeated N times)
Output
Name Description Example
0 5 5 0
0 5 4 3 4 5 0
Sequence 0 -5 -4 -3 -2 -3 -4 -5 0
A list of integers separated by spaces, each representing a pace
(repeated N times)
Good Luck!
u too? [Link]/career
#WeLoveSoftware
#WeLoveSoftware
u too? [Link]/career