2756 - DS_2023Spring_Homework1 Scoreboard

Time

2023/03/08 21:00:00 2023/03/26 23:59:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
13841 Temple Run

13841 - Temple Run   

Description

Temple Run used to be a popular game over a decade ago. It introduced the “endless runner” concept, which was a new way to play games at the time and drew the attention of countless children. However, as you grew older, you began to realize that the endless running was a subtle mockery  of your own life. 

 

There are these following moves in Temple Run:

  1. Turn Left (TL)

  2. Turn Right (TR)

  3. Keep Left (KL)

  4. Keep Right (KR)

  5. JUMP

  6. FLIP

  7. MISS

 

To begin with, it is important to understand that in the temple's crossroads, there is no straightforward route to take. Hence, the only way to navigate through it is by making either a left turn (TL) or a right turn (RL).

 

Secondly, while making your escape from the temple, you will come across numerous treasures as well as frustrating obstacles. In order to successfully navigate through them, you will need to execute specific moves such as KL, KR, JUMP, and FLIP to collect treasures and avoid obstacles. Failure to use the correct move will result in a MISS tag being added to your move.

 

Example:

  1. If you choose to JUMP when FLIP is required, a MISS tag will be appended after the JUMP move.

  2. If you choose to JUMP when JUMP is required, then JUMP will be recorded without extra tag.

 

After completing the exploration, the first thing you need to do is to count your loot (gold and silver treasures) and review the route back to the temple.

 

There exist two distinct types of treasures - GOLD and SILVER. The value of these treasures is determined by the order in which they are obtained. When three consecutive treasures are acquired, they form a group, and any remaining treasures that are not part of a group hold no value. The number of GOLD treasures within a group (independent of their order) determines the group's overall value, according to the following criteria:

 

  1. GOLD GOLD GOLD: 500 points.

  2. GOLD GOLD SILVER: 300 points.

  3. GOLD SILVER SILVER: 150 points.

  4. SILVER SILVER SILVER: 50 points.

 

Before determining the value of the treasures, it is crucial to take into account the occurrence of MISS tags. As previously mentioned, if you mistakenly execute a JUMP instead of a FLIP, you will collide with a large tree branch and become disoriented. When a MISS occurs, you will be unable to collect the next four treasures. Nevertheless, being an accomplished tomb raider, you will still document these missed treasures and add them to your total count upon successfully escaping from the temple.

(p.s. C++ Standard Library like vector, stack, queue are not allowed!!!)

Input

  1. There are n inputs in total, consisting of a series of TL, TR, KL, KR, JUMP, FLIP, MISS, GOLD, and SILVER, separated by '\n'.

  2. The total number of operations is guaranteed to be 0 < n <= 100.

  3. There must have at least 1 TR or TL

Output

  1. The route back to the temple from the city, is separated by ->, followed by a line break.

  2. The total value of treasures successfully collected, followed by a line break.

  3. The total value of treasures had there been no mistake (MISS), followed by a line break.

Sample Input  Download

Sample Output  Download

Tags

stack queue 23S_DS



Discuss