#include using namespace std; typedef long long ll; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b dh={-1,-1,1,1},dw={-1,1,-1,1}; int main(){ std::ifstream in("text.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); int H,W;cin>>H>>W; vector S(H); for(int i=0;i>S[i]; } vector>> dp(4,vector>(H,vector(W))),T; T=dp; for(int t=0;t<4;t++){ if(t<2){ for(int i=0;i=0;i--){ for(int j=0;j=2){ for(int k=0;k<4;k++){ T[k][i][j]=can; //cout<=2){ for(int i=0;i=0;i--){ for(int j=0;j