#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long int
#define endl '\n'
#define N 210
#define M 400100
#define big 2147483647
#define bigg 9223372036854775807
#define pb push_back
#define p push
#define ins insert
#define f first
#define s second
int arr[N][N],green[N][N];
int r,c;
int dfs(int x,int y,int a,int b){
queue<pair<int,int>> q;
q.p({x,y});
while(q.size()){
x=q.front().f,y=q.front().s;
q.pop();
if(arr[x][y])continue;
arr[x][y]=1;
if(x==a&&y==b)return 1;
if(y!=c&&arr[x][y+1]==0){
q.p({x,y+1});
}
if(x!=r&&arr[x+1][y]==0&&green[x][y]){
q.p({x+1,y});
}
}
return 0;
}
void solve(){
memset(green,0,sizeof(green));
int n;cin>>r>>c>>n;
vector<int> yedek;
for(int i=0;i<n;i++){
int a,b;cin>>a>>b;
green[a][b]=1;
}
int q;cin>>q;
while(q--){
memset(arr,0,sizeof(arr));
int x,y,a,b;cin>>x>>y>>a>>b;
int ok=dfs(x,y,a,b);
if(ok)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}
signed main(){
lalala;
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1112 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
15 ms |
1156 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
7 ms |
1112 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
1112 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
1112 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
1116 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
1112 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |