#include <bits/stdc++.h>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("-O1")
//-------------------------------------------------------------//
typedef long long ll;
typedef unsigned long long ull;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sum_to(n) (n*(n+1))/2
#define pb push_back
#define pf push_front
#define sz size()
#define fil(arr,x) memset(arr,x,sizeof(arr))
const ll mod=1e9+7;
int dx[8]={0,1,0,-1,1,1,-1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
//-------------------------------------------------------------//
ll lcm(ll a,ll b)
{
return (max(a,b)/__gcd(a,b))*min(a,b);
}
void person_bool(bool x)
{
cout<<(x?"YES":"NO")<<endl;
}
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
fast
int r,c,n;
cin>>r>>c>>n;
map<int,vector<int>>arr;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
arr[x].pb(y);
}
if(r<=3000){
for(int i=1;i<=r;i++){
if(arr[i].sz)sort(all(arr[i]));
}
}
int q;cin>>q;
while(q--){
int x,y,a,b;
cin>>x>>y>>a>>b;
if(a<x || b<y || a-x>n){
cout<<"No"<<endl;
}
else{
int p=y;
bool valid=1;
for(int i=x;i<a;i++){
if(!arr[i].sz){
valid=0;
break;
}
int j=lb(all(arr[i]),p)-arr[i].begin();
if(j==arr[i].sz || arr[i][j]>b){
valid=0;
break;
}
else{
p=arr[i][j];
}
}
cout<<(valid?"Yes":"No")<<endl;
}
}
return 0;
}
Compilation message
trampoline.cpp: In function 'int main()':
trampoline.cpp:69:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
69 | if(j==arr[i].sz || arr[i][j]>b){
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
3 ms |
340 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
2 ms |
340 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
88 ms |
1964 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
89 ms |
2016 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
324 ms |
1524 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
532 ms |
2124 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
148 ms |
13840 KB |
expected YES, found NO [4th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
596 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
710 ms |
21256 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |