#include using namespace std; namespace myDef { template struct Node_queue { T_queue num; Node_queue *next=0; }; template struct queue { Node_queue *head=0,*tail=0,*L=0; bool isn=0; int SIZE_queue; void beginning() { head=tail=new Node_queue; tail->next=head; SIZE_queue=0; isn=1; } bool push(a_queue s) { SIZE_queue++; tail->num=s; if(tail->next==head) { tail->next=new Node_queue; tail->next->next=head; L=tail; tail=tail->next; return 1; } L=tail; tail=tail->next; return 0; } bool pop() { if(head==tail) return 1; head=head->next; SIZE_queue--; return 0; } a_queue& front() { return head->num; } a_queue& back() { return L->num; } int size() { return SIZE_queue; } void clear() { SIZE_queue=0; tail=head; } a_queue& operator[](unsigned int w) { w=w%SIZE_queue; Node_queue *p=head; for(int i=0;inext; return p->num; } void operator()() { beginning(); } bool empty() { return (SIZE_queue==0); } bool operator=(myDef::queueb) { if(!isn) { this->beginning(); isn=1; } this->clear(); Node_queue *p=b.head; while(p!=b.tail) { this->push(p->num); p=p->next; } } }; } using myDef::queue; struct Point { int x,y; }; queueBFS; int n; Point a,b,xx; char Map[110][110]; int dx[4]={0,1,0,-1}, dy[4]={-1,0,1,0}; bool check(int x,int y) { if(x>=0&&x=0&&y0) { for(int i=0;i>k; bool answer[k]; for(int i=0;i>n; for(int i=0;i>Map[j][i]; cin>>a.y>>a.x>>b.y>>b.x; answer[i]=findRoad(); } for(int i=0;i