// input checker probC - ECNA2015 #include using namespace std; int n,m,t; char op; int r,c; int grid[10][10]; void cleargrid(){ for(int i=1; i<10; i++) for(int j=1; j<10; j++) grid[i][j]=0; } void floodfill(int a, int b){ if (a>0 && a<=n && b>0 && b<=n && grid[a][b]==2){ grid[a][b]=1; floodfill(a-1,b); floodfill(a+1,b); floodfill(a,b-1); floodfill(a,b+1); } } bool IsConnected(){ for(int i=1; i<10; i++) for(int j=1; j<10; j++) if (grid[i][j]==2) return false; return true; } int main(){ cin>>n>>m>>t>>op; if(n<4 || n>9) { cout<<"n out of bounds"; return 1; } if (m<2 || m>10) { cout<<"m out of bounds"; return 2; } if (t<1) { cout<<"t out of bounds"; return 3; } if (op!='+' && op!='-' && op !='*' && op !='/') { cout<<"op not correct"; return 4; } cleargrid(); //place squares on grid for(int i=0;i>r>>c; grid[r][c]=2; } floodfill(r,c); if(!IsConnected()) { cout<<"section not connected"; return 5; } cout<