#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
vector<ii> V;
int check(int x1, int y1, int x2, int y2){
if (x1>x2||y1>y2) return false;
if (x1==x2) return true;
int curx=x1, cury=y1;
while (x1 <= x2 && y1 <= y2){
// find a green
ii pos=*lower_bound(V.begin(),V.end(),ii({curx,cury}));
//cout<<"Curr: "<<curx<<" "<<cury<<"\n";
//cout<<"Green: "<<pos.first<<" "<<pos.second<<"\n";
// no greens left in row = screwed
if (curx!=pos.first) return false;
// assume verticaling
if (pos.first+1==x2) return true;
curx=pos.first+1;
cury=pos.second;
//cout<<"Curr: "<<curx<<" "<<cury<<"\n";
}
return false;
}
int main(){
int R, C, N;
cin>>R>>C>>N;
for (int i=0; i<N; i++){
int a,b; cin>>a>>b; V.push_back(ii({a,b}));
}
sort(V.begin(), V.end());
int K; cin>>K;
while (K--){
int x1,x2,y1,y2; cin>>x1>>y1>>x2>>y2;
if (check(x1,y1,x2,y2)) cout<<"Yes\n";
else cout<<"No\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
600 KB |
expected NO, found YES [2nd token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
111 ms |
2532 KB |
expected NO, found YES [121st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
588 ms |
2748 KB |
expected NO, found YES [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
600 KB |
expected NO, found YES [59th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2058 ms |
2516 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |