#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 (true){
// find a green
ii pos=*lower_bound(V.begin(),V.end(),ii({curx,cury}));
// 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;
}
}
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 |
604 KB |
expected NO, found YES [2nd token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
111 ms |
2500 KB |
expected NO, found YES [121st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
589 ms |
2684 KB |
expected NO, found YES [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
344 KB |
expected NO, found YES [59th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2045 ms |
2596 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |