/** made by amunduzbaev **/
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define NeedForSpeed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vii;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}
#define no cout<<"No\n"
#define yes cout<<"Yes\n"
const int N = 2e5+5;
const int mod = 1e9+7;
const ll inf = 1e18;
const ld Pi = acos(-1);
#define MULTI 0
int n, m, k, ans, res, a[N];
void solve(int t_case){
cin>>n>>m>>k;
map<int, vii> mm;
vpii tt;
for(int i=0;i<k;i++){
int x, y; cin>>x>>y;
tt.pb({x, y});
}sort(all(tt));
for(auto x:tt) mm[x.ff].pb(x.ss);
int t; cin>>t;
for(int i=0;i<t;i++){
int x, y, x1, y1; cin>>x>>y>>x1>>y1;
//if(x == x1 && y <= y1) { yes; continue; }
if(x1 < x || y1 < y || !mm.count(x)) { no; continue; }
bool ok = 1;
while(x < x1 && ok){
if(!mm.count(x)) ok = 0;
auto tt = lb(all(mm[x]), (int)y);
if(tt == mm[x].end()) break;
y = *tt, x++;
}
if(x == x1 && y <= y1) yes;
else no;
}
}
signed main(){
NeedForSpeed
if(!MULTI) {
solve(1);
} else {
int t; cin>>t;
for(int t_case = 1; t_case <= t; t_case++) solve(t_case);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
748 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
6 ms |
748 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
3 ms |
620 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
131 ms |
6256 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
138 ms |
6236 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
330 ms |
5596 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
702 ms |
6368 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
197 ms |
6748 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
208 ms |
6492 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
216 ms |
6108 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
261 ms |
6792 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
252 ms |
6620 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
349 ms |
12536 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
620 KB |
5000 token(s): yes count is 3238, no count is 1762 |
2 |
Correct |
13 ms |
876 KB |
5000 token(s): yes count is 3837, no count is 1163 |
3 |
Correct |
8 ms |
1388 KB |
5000 token(s): yes count is 4104, no count is 896 |
4 |
Correct |
6 ms |
876 KB |
5000 token(s): yes count is 3934, no count is 1066 |
5 |
Correct |
486 ms |
1132 KB |
5000 token(s): yes count is 3384, no count is 1616 |
6 |
Correct |
6 ms |
1004 KB |
5000 token(s): yes count is 3390, no count is 1610 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2086 ms |
13016 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |