Woburn Challenge 2018-19 Round 4 - Senior Division
Billy, the king of video games, is (among other things) a top professional StarCraft II player. In light of his recent success as the only human to defeat the fearsome AlphaStar AI, he has received exclusive access to play the upcoming installment in the series, World of StarCraft. In a natural progression for the series, this is a massively multiplayer online role-playing game.
World of StarCraft features P
for Protoss, T
for
Terran, or Z
for Zerg).
There are
Despite its secretive and unreleased development status, World of
StarCraft somehow already has an enormous player-base. Billy himself
has
When a player is on planet
Billy would love to help all of his friends complete their objectives,
but not without putting their in-game lives at risk! Help him determine
how many friends
Subtasks
In test cases worth
Input Specification
The first line of input consists of three space-separated integers,
The next line consists of characters,
Output Specification
Output a single integer, the number of friends who can safely complete their objectives.
Sample Input
6 7 3
PZZPPP
1 2
6 4
3 4
2 5
5 6
1 4
4 2
6 4
2 3
1 5
Sample Output
2
Sample Explanation
Billy's first friend can safely travel directly from planet
Billy's second friend may never safely reach planet
Billy's third friend can safely travel through the sequence of planets
Comments