TENKA1_2015_QUALA C. 天下一美術館
Difficulty:2078
問題
解法
実装
code:cpp
bool solve(){
LL(n,m);
vector a(n,vector(m,0)),b(n,vector(m,0));
rep(i,n){
}
rep(i,n){
}
vector diff(n,vector(m,0));
rep(i,n)rep(j,m)if(aij!=bij)diffij=1; mf_graph<ll>g(n*m+2);
ll S = n*m,T = n*m+1;
ll ans{};
rep(i,n){
rep(j,m){
if(!aij)g.add_edge(S,i*m+j,1); else g.add_edge(i*m+j,T,1);
ans++;
rep(k,4){
ll ni = i + dxk,nj = j + dyk; if(ni<0||nj<0||ni>=n||nj>=m)continue;
g.add_edge(i*m+j,ni*m+nj,1);
}
}
}
}
}
}
O(ans-g.flow(S,T));
return false;
}