#include<bits/stdc++.h>
using namespace std;
int main(){
int r, c, t;
cin >> r >> c >> t;
map<int, vector<int> > mp;
for(int i=0; i<t; i++){
int a, b;
cin >> a >> b;
if(!mp.count(a)){
vector<int> temp;
mp[a] = temp;
}
mp[a].push_back(b);
}
for(auto u : mp){
sort(u.second.begin(), u.second.end());
}
// for(auto u : mp){
// if(mp.count(u.first+1)==0){
// continue;
// }
// auto temp = mp[u.first+1];
// for(auto x : u.second){
// x.second = lower_bound(temp.begin(), temp.end(), x.first)->first;
// }
// }
int q;
cin >> q;
while(q--){
int a, b, c, d;
cin >> a >> b >> c >> d;
while(a<c && b<=d){
if(!mp.count(a)) break;
vector<int> temp = mp[a];
auto it = lower_bound(temp.begin(), temp.end(), b);
if(it==temp.end()){
break;
}
else{
b = *it;
a++;
}
// cout << a << ", " << b << "\n";
}
if(b<=d && a==c) cout << "Yes\n";
else cout << "No\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
348 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
109 ms |
1944 KB |
expected YES, found NO [3rd token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2041 ms |
2964 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
348 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
974 ms |
9872 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |