Submission #691525

#TimeUsernameProblemLanguageResultExecution timeMemory
691525AiperiiiTrampoline (info1cup20_trampoline)C++14
23 / 100
2083 ms1048576 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int r,c,n; cin>>r>>c>>n; map < pair <int,int> ,int> mp; while(n--){ int x,y; cin>>x>>y; pair <int,int> p=make_pair(x,y); mp[p]=1; } int t; cin>>t; while(t--){ int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; vector <vector <int> > d(r+1,vector <int> (c+1,-1)); queue <pair <int,int> > q; d[x1][y1]=0; pair <int,int> p=make_pair(x1,y1); q.push(p); while(!q.empty()){ pair <int,int> curv=q.front(); q.pop(); if(curv.first+1<=r){ pair <int,int> p=make_pair(curv.first+1,curv.second); if(mp[curv]==1 && d[curv.first+1][curv.second]==-1){ d[curv.first+1][curv.second]=1; q.push(p); } } if(curv.second+1<=c){ pair <int,int> p=make_pair(curv.first,curv.second+1); if(d[curv.first][curv.second+1]==-1){ d[curv.first][curv.second+1]=1; q.push(p); } } } if(d[x2][y2]==1) cout<<"Yes\n"; else cout<<"No\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...