Plan a route from the origin that smashes the most time-windowed zombies given Chebyshev travel time and a 750 ms weapon recharge.
Medium6Dynamic programmingSortingGraphNo attempts yetTime limit5sMemory limit512 MBYou are playing Zombie Smash. Zombies pop out of graves in a graveyard, and you smash them with your Zombie Smasher. The graveyard is a flat 2D grid. Each zombie pops out of a grave at some cell (X,Y), stands there for 1000 milliseconds, then drops back into the grave. At most one zombie stands at a grave at any moment.
You move to any one of the 8 cells adjacent to your cell in 100 ms, so you can go north, east, south, west, northwest, northeast, southwest and southeast. You may walk through a cell or stand on it even while a zombie occupies it. Reaching the cell of a standing zombie smashes that zombie instantly, but after a smash the Zombie Smasher takes 750 ms to recharge before it can smash again. You may keep moving while it recharges. For example, right after smashing a zombie at (0,0):
You start on cell (0,0) at time 0. After you play a level, you want to know how many zombies you could have smashed with optimal play.
The first line contains one integer T, the number of test cases. Each test case starts with a line holding one integer Z, the number of zombies in the level.
The next Z lines each contain 3 space separated integers Xi, Yi and Mi, describing where and when zombie i appears.
For each test case, print one line containing "Case #c: d", where c is the case number starting from 1, and d is the largest number of zombies you could have smashed in that level.