#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#define endl '\n'
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<long long>
#define sz(x) (int)x.size()
#define int long long
#define float double
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define rep(i,a,b) for (ll i = a; i<b; i++)
#define repo(i,a,b) for (int i = a; i>=b; i--)
#define fi first
#define se second
//int decrow[4] = {-1,0,1,0};
//int deccol[4] = {0,1,0,-1};
//int dp[100001][100001];
//int arr[100001];
int dy[8] = {0, 0, 1, -1, 1, -1 , 1, -1};
int dx[8] = {1, -1, 0, 0, 1, -1, -1, 1};
const int MAXN = 1e6;
const int MOD = 1e9+7;
const int INF = 1e18;
int n,c,r;
int total = 0;
int ans = 0;
vi v;
int largerThanX(set<int> &s, int x){
auto it = s.upper_bound(x);
if(it == s.end()) return -2; /// x is larger than everything
return *it;
}
gp_hash_table<int,set<int>> mp;
void solve(){
int t;
cin>>r>>c>>n;
for(int i = 0;i<n;i++){
int a,b;
cin>>a>>b;
mp[a-1].insert(b-1);
}
cin>>t;
while(t--){
int a,b,aa,bb;
cin>>a>>b>>aa>>bb;
a--,b--,aa--,bb--;
//only do on bb and b
int last = b;
int swi = 1;
if(aa<a || bb<b){
cout<<"No"<<endl;
continue;
}
for(int i = a;i<aa;i++){
int place = largerThanX(mp[i],last-1);
if(place == -2){
cout<<"No"<<endl;
swi = 0;
break;
}else{
if(place <= bb){
last = place;
}else{
swi = 0;
cout<<"No"<<endl;
break;
}
}
}
if(swi == 1){
cout<<"Yes"<<endl;
}
}
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int q;
q =1;
while(q--){
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
860 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
3 ms |
860 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
2 ms |
860 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
78 ms |
10216 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
79 ms |
10112 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
215 ms |
9808 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
155 ms |
10116 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
179 ms |
10424 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
187 ms |
10832 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
171 ms |
10320 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
166 ms |
10828 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
181 ms |
11008 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
186 ms |
42264 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
716 KB |
5000 token(s): yes count is 3238, no count is 1762 |
2 |
Correct |
6 ms |
860 KB |
5000 token(s): yes count is 3837, no count is 1163 |
3 |
Correct |
5 ms |
2616 KB |
5000 token(s): yes count is 4104, no count is 896 |
4 |
Correct |
4 ms |
860 KB |
5000 token(s): yes count is 3934, no count is 1066 |
5 |
Correct |
19 ms |
1116 KB |
5000 token(s): yes count is 3384, no count is 1616 |
6 |
Correct |
4 ms |
864 KB |
5000 token(s): yes count is 3390, no count is 1610 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2096 ms |
35604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |