#include #include #include #include #include #include #include #include using namespace std; #define REP(i,j,n) for(int i=j;i lt; }cells[1001][1001]; //map > > mp; int x,y,stx,sty; int exits; void display(){ REP(i,0,x){ REP(j,0,y) cout<>x>>y; cin>>stx>>sty; stx--; sty--; REP(i,0,x) REP(j,0,y) { cells[i][j].prevy=-1; cells[i][j].prevx=-1; scanf("%d",&cells[i][j].trav); cells[i][j].exit=false; } cells[stx][sty].trav=1; cells[stx][sty].prevx=-1; cells[stx][sty].prevy=-1; int path; cin>>path; int x1,y1,x2,y2; REP(i,0,path) { scanf("%d %d %d %d",&x1,&y1,&x2,&y2); cells[x1-1][y1-1].path=true; cells[x1-1][y1-1].lt.PB(point(x2-1,y2-1)); } cin>>exits; REP(i,0,exits){ scanf("%d %d",&x1,&y1); cells[x1-1][y1-1].exit=true; } queue q; q.push(point(stx,sty)); bool flag=false; int markx,marky; while(!q.empty()){ point a=q.front(); q.pop(); x1=a.x; y1=a.y; if(cells[x1][y1].exit==true) { markx=x1; marky=y1; // cout<-1&&cells[x1-1][y1].trav==0){ q.push(point(x1-1,y1)); cells[x1-1][y1].trav=1; cells[x1-1][y1].prevx=x1; cells[x1-1][y1].prevy=y1; // cout<-1&&cells[x1][y1-1].trav==0){ q.push(point(x1,y1-1)); cells[x1][y1-1].trav=1; cells[x1][y1-1].prevx=x1; cells[x1][y1-1].prevy=y1; } if((y1+1) stk; stk.push(res); int size=1; while(stk.top().x!=-1&&stk.top().y!=-1){ // cout<1) { stk.pop(); cout<>x; return 0; }