网格图黑白染色,然后能互相攻击到的点之间连边,跑匈牙利算法最大匹配,答案是好点个数-最大匹配(最大独立集) 注意pao的时候只从一种颜色的格子统计即可 #include<iostream> #include<cstdio> using namespace std; const int N=205,dx[]={2,2,-2,-2,-1,-1,1,1},dy[]={-1,1,-1,1,-2,2,-2,2}; int n,m,sum,h[N*N],cnt,id[N][N],a[N][N]…
Cat VS Dog Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 4039 Accepted Submission(s): 1458 Problem Description The zoo have N cats and M dogs, today there are P children visiting the zoo,…