ve as little as possible. When an arrow reaches the top of the screen, if one of your feet is already on the correct arrow, you are awarded one point for not having to move. If neither foot is on the correct arrow, you must move exactly one foot from its current location to the correct arrow on the platform (you do not receive a point here because you moved). If you ever step on the wrong arrow or fail to step on the correct arrow or move more than one foot at a time or move either foot when you are already standing on the correct arrow, you instantly lose your life. How should you move your feet to maximize the total number of points? Assume that you always start with your left foot on and your right foot on !. (a) Show that, if you do not know the sequence of arrow
You are playing a game variant of Dance Dance Revolution where the goal is to play
perfectly but move as little as possible. When an arrow reaches the top of the screen, if one of your feet
is already on the correct arrow, you are awarded one point for not having to move. If neither foot is
on the correct arrow, you must move exactly one foot from its current location to the correct arrow on
the platform (you do not receive a point here because you moved). If you ever step on the wrong
arrow or fail to step on the correct arrow or move more than one foot at a time or move either
foot when you are already standing on the correct arrow, you instantly lose your life.
How should you move your feet to maximize the total number of points? Assume that you always start
with your left foot on and your right foot on !.
(a) Show that, if you do not know the sequence of arrows for the song ahead of time and you can
only react to arrows one at a time, then there is no
points.
(b) Okay. So, to prepare for the game, you have memorized the entire sequence of arrows beforehand
for the song. Show that for any song (a sequence of n arrows), it is possible to earn at least
n/4 - 1 points.
(c) Describe an e cient algorithm to nd the maximum number of points you can earn during a given
song. The input is an array A[1 : : : n] which contains the sequence of arrows.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images