Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<iostream>#include<vector>using namespace std;int check(vector<vector<int>>& t, int i, int j){int flag = 0;int row1 = t[i][j] + t[i][j+1] + t[i][j+2];int row2 = t[i+1][j] + t[i+1][j+1] + t[i+1][j+2];int row3 = t[i+2][j] + t[i+2][j+1] + t[i+2][j+2];int col1 = t[i][j] + t[i+1][j] + t[i+2][j];int col2 = t[i][j+1] + t[i+1][j+1] + t[i+2][j+1];int col3 = t[i][j+2] + t[i+1][j+2] + t[i+2][j+2];int cr1 = t[i][j] + t[i+1][j+1] + t[i+2][j+2];int cr2 = t[i][j+2] + t[i+1][j+1] + t[i+2][j];if ((row1 == row2) && (row2 == row3)&& (col1 == col2) && (col2 == col3) && (cr1 == cr2)&& (col1 == row1) && (row1 == cr1)) {flag = 1;}return flag;}int main(){int N, M, cnt = 0;cin>>N>>M;vector<vector<int> > m(N, vector<int>(M));for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>m[i][j];}