#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 |
1 |
Correct |
3 ms |
332 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
3 ms |
444 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
3 ms |
336 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
1984 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
97 ms |
4020 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
211 ms |
3012 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
449 ms |
3904 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2111 ms |
366924 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2096 ms |
389776 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2113 ms |
392616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |