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(void) {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
map <int,vector <int>> a;
int q;
cin >> q;
while(q --) {
int x, y;
cin >> x >> y;
x --;
y --;
a[x].push_back(y);
}
for(int i = 0; i < n; i ++) sort(a[i].begin(), a[i].end());
cin >> q;
while(q --) {
int startx, starty, endx, endy;
cin >> startx >> starty >> endx >> endy;
startx --;
starty --;
endx --;
endy --;
while(startx != endx) {
auto it = lower_bound(a[startx].begin(), a[startx].end(), starty);
if(it == a[startx].end()) {
goto end;
}
startx ++;
starty = *it;
}
if(startx == endx and starty <= endy){
cout << "Yes\n";
}else cout << "No\n";
continue;
end:;
cout << "No\n";
}
return false;
}
# | 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... |