#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
using namespace std;
void solve(){
ll r,c,n;
cin >> r >> c >> n;
map< ll, vector<ll> > down;
//vector<ll> emptyhehe;
while(n--){
ll x,y; cin >> x >> y;
if( down.find(x) == down.end() ){ down[x] = {}; }
down[x].pb(y);
}
for( pair<ll,vector<ll> > keyvalue : down ){
ll i = keyvalue.first;
sort( down[i].begin(), down[i].end() );
}
ll t;
cin >> t;
while(t--){
ll x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;
if( x1 > x2 || y1 > y2 ){ cout << "No" << endl; continue; }
bool yes = true;
for( int i = x1; i < x2; i++ ){
if( down.find(i) == down.end() ){ yes = false; break; }
auto it = lower_bound( down[i].begin(), down[i].end(), y1 );
if( it == down[i].end() ){ yes = false; break; }
y1 = *it;
if( y1 > y2 ){ yes = false; break; }
}
cout << ( yes ? "Yes" : "No") << endl;
}
return;
}
int main(){
//freopen( "input.txt", "r", stdin );
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t = 1; //cin>>t;
while(t--){ solve(); }
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
460 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
3 ms |
460 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
3 ms |
332 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
3364 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
94 ms |
3332 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
265 ms |
2756 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
359 ms |
3316 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
383 ms |
3668 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
391 ms |
3416 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
388 ms |
3208 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
412 ms |
3780 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
427 ms |
3648 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
572 ms |
9668 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
332 KB |
5000 token(s): yes count is 3238, no count is 1762 |
2 |
Correct |
16 ms |
708 KB |
5000 token(s): yes count is 3837, no count is 1163 |
3 |
Correct |
13 ms |
1156 KB |
5000 token(s): yes count is 4104, no count is 896 |
4 |
Correct |
10 ms |
680 KB |
5000 token(s): yes count is 3934, no count is 1066 |
5 |
Correct |
374 ms |
768 KB |
5000 token(s): yes count is 3384, no count is 1616 |
6 |
Correct |
10 ms |
716 KB |
5000 token(s): yes count is 3390, no count is 1610 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2098 ms |
10088 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |