#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";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
604 KB |
YES or NO expected, but CURR: found [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
217 ms |
11708 KB |
YES or NO expected, but CURR: found [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
652 ms |
11636 KB |
YES or NO expected, but CURR: found [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
1372 KB |
YES or NO expected, but CURR: found [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2059 ms |
282864 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |