This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |