#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; x--; y--;
if( down.find(x) == down.end() ){ down[x] = emptyhehe; }
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; x1--; y1--; x2--; y2--;
if( x1 > x2 ){ 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
460 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
4 ms |
556 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
4 ms |
448 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
93 ms |
3740 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
94 ms |
3724 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
264 ms |
2884 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
387 ms |
3584 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
390 ms |
15168 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
380 ms |
15188 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
390 ms |
14788 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
450 ms |
15448 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
438 ms |
15556 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
561 ms |
21060 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
588 KB |
expected NO, found YES [16th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2027 ms |
14108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |