传送门 把所有非障碍的相邻格子彼此连一条边,然后求二分图最大匹配,看 tot * 2 + k 是否等于 n * m 即可. 但是连边不能重复,比如 a 格子 和 b 格子 相邻,不能 a 连 b ,b 也连 a. 所以可以人为规定,横纵坐标相加为 奇数 的格子连横纵坐标相加为 偶数 的格子. 如果一个格子横纵坐标相加为奇数,那么它的上下左右四个格子横纵坐标相加必定为偶数. ——代码 #include <cstdio> #include <cstring> using namespa…
Destroying The Graph Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8198 Accepted: 2635 Special Judge Description Alice and Bob play the following game. First, Alice draws some directed graph with N vertices and M arcs. After that B…