ICPC-2 Code: Z25 Assault/harmful event problem