// // Created by zeronosu77108 on Jan 15, 2021. // #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<ostream &operator<<(ostream &o,const vector&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<> n >> m; vector a(n, vector(n, 0)); for (int i=0; i> a[i][j]; } vector row(n, 0); for (int i=0; i>k&1)==0) col[j][i] += a[k][j]; } } } long comb = (1L<> 1) | y; long d = comb & 3; long r = ((comb)>>2) & ((1<>(n+2)); long sum = 0; for (int i=0; i>i&1) { sum += row[i]; } } for (int i=0; i>i&1) { sum += col[i][r]; } } if (d&1) { for (int i=0; i>i&1 || c>>i&1) continue; sum += a[i][i]; } } if (d&2) { for (int i=0; i>i&1 || c>>(n-i-1)&1) continue; sum += a[i][n-i-1]; } } ans = min(ans, sum); } cout << ans << endl; }