#include using namespace std; typedef pair PII; mapm; vectors; int x1[4]={1,0,-1,0}; int y5[4]={0,1,0,-1}; bool vis[21][21]; int n; int m1; int path(int x,int y) { queueq; q.push(make_pair(x,y)); int sum=0; int l=0; while(!q.empty()) { PII p=q.front(); q.pop(); int i=p.first; int j=p.second; //cout<=n||v>=m1) continue; sum++; if(l==0) { if(vis[u][v]==false) { if(s[u][v]=='%') { l++; } if(s[u][v]=='O') { if(m.find(make_pair(u,v))!=m.end()) { q.push(m[make_pair(u,v)]); } else { q.push(make_pair(u,v)); } } } } } } return sum; } int main() { // freopen("in.txt","r",stdin); // freopen("out1.txt","w",stdout); int k,i,j,x,y; cin >> n >> m1>> k; for(int a0 = 0; a0 < n; a0++){ string row; cin >> row; s.push_back(row); for(i=0;i> i1 >> j1 >> i2 >> j2; i1=i1-1; i2=i2-1; j1=j1-1; j2=j2-1; m[make_pair(i1,j1)]=make_pair(i2,j2); m[make_pair(i2,j2)]=make_pair(i1,j1); // Write Your Code Here } // Write Your Code Here int z=path(x,y); //cout<