Editorial - ICM2006

PROBLEM LINK:

Practice
Div-1+2 Contest

Author: Bhagya Kamal Jain
Tester: Jatin Yadav
Editorialist: Bhagya Kamal Jain

DIFFICULTY:

EASY

PREREQUISITES:

Greedy, Strings

PROBLEM:

You are given a string and you have to tell whether it is can be generated by the tour.

QUICK EXPLANATION:

Simply iterate over the string and move through corresponding cities.

EXPLANATION:

When you process the given string jump in between the cities according to the current character. If at the end of the string If the tour ends at the green city output YES.

ALTERNATE EXPLANATION:

BONUS

You may notice that only the strings ending with ‘1000’ are accepted.

SOLUTIONS:

Setter's Solution

https://www.codechef.com/submit/complete/29748247

Editorialist's Solution

https://www.codechef.com/submit/complete/29748247