/*
* author: NeroZein
* created: 01.02.2023 13:03:54
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int r, c, n;
cin >> r >> c >> n;
map<int, set<int>> se;
for (int i = 0; i < n; ++i) {
int x, y;
cin >> x >> y;
se[x].insert(y);
}
int q;
cin >> q;
while(q--) {
int xs, ys, xf, yf;
cin >> xs >> ys >> xf >> yf;
while(yf > ys && xf > xs) {
if (se[xf-1].empty()) {
break;
}
auto it = se[xf-1].upper_bound(yf);
if (it == se[xf-1].begin()) {
break;
}
--it;
yf = *it;
--xf;
}
cout << (xf == xs && yf >= ys ? "YES" : "NO") << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
752 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
5 ms |
720 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
3 ms |
596 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
167 ms |
9896 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
154 ms |
9972 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
544 ms |
9744 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Incorrect |
565 ms |
9936 KB |
expected YES, found NO [993rd token] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
279 ms |
20940 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
271 ms |
22096 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
340 ms |
22012 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
297 ms |
22212 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
307 ms |
22304 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
382 ms |
28240 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
724 KB |
5000 token(s): yes count is 3238, no count is 1762 |
2 |
Correct |
13 ms |
844 KB |
5000 token(s): yes count is 3837, no count is 1163 |
3 |
Correct |
6 ms |
1316 KB |
5000 token(s): yes count is 4104, no count is 896 |
4 |
Correct |
6 ms |
840 KB |
5000 token(s): yes count is 3934, no count is 1066 |
5 |
Correct |
236 ms |
996 KB |
5000 token(s): yes count is 3384, no count is 1616 |
6 |
Correct |
5 ms |
832 KB |
5000 token(s): yes count is 3390, no count is 1610 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2056 ms |
20276 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |