CF733C Epidemic in Monstropolis
Solution Sketch
Key observations:
- Use prefix table to group initial weights of the monsters to match weights of the monsters after the joke. (make sure to check if grouping is possible or not -> WA test case 119)
- For each group, if the maximum number in that group has a smaller number on its left or right, then reduction is possible.
AC Code
|
|