• [1127] Kill the Zombies

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Magical girl just rescued the princess from the zombie Castle,so The Zombie King was very angry and sent most of the zombies to pursue the magical girl.As a result, magical girl consumed a large amount of capacity so that she can not continue to fight,so she set some traps to stop the zombies'advance.If both the trap and zombie were at the same lattice,the trap will be swallowed by zombie,then the zombie and the trap will disappear together.The trap was triggerred from left to right one by one in the map(if there were at least two traps on the same column,in the above will be the first to launch).After the launch,the trap will produce flame,it will spread for four directions ,whatever it will meet,the flame will continue to go forward out of map(left is first,then is up,after is right,last is down).The trap will disappear after the launch.If the flame hit the another trap,the trap which was hit will disappear;if the flame hit the zombie,just before it happened,the zombie will move a lattice to dodge the flame(up is first than down,left is first than right,the zombie can not move out of map),if there was a zombie has occupied the lattice,that zombie can not move and he will move to another direction,if there was also a zombie has occupied contrary direction of the lattice,the zombie will fall back one lattice(if there was a zombie in this zombie's back,he will eat the zombie behind)and this zombie will also be burned to death.

    ps : for each zombie, he just move one step.
  • 输入
  • The input data include several cases, input until EOF.
    In each case,there will be two integers m and n(2<m,n<10)stands map at first line,m is the number of lines,n is the number of columns.
    Then it will follow one integer w means the number of zombies,then it follows w lines,each line include two integers x and y means the coordinate of zombie(x is the coordinate of line,y is the coordinate of column).
    Then it will follow one integer t means the number of traps,then it follows t lines,each line include two integers x and y means the coordinate of zombie(x is the coordinate of line,y is the coordinate of column).
  • 输出
  • For each case, you should output the survival of zombies.
  • 样例输入
  • 4 5
    6
    0 0
    1 0
    1 2
    2 1
    2 2
    3 2
    2
    1 1
    2 3
  • 样例输出
  • 5
  • 提示
  • 来源
  • hungar
  • 操作

显示春菜