#include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << #x<<' '<< x <<'\n'
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ro(i,n) for(i=n;i<=0;i--)
#define Ro(i,k,n) for(i=k;i<n;i--)
#define ll long long
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define vl vector<ll>
#define vpll vector<pll>
#define pb push_back
#define MEMINF 0x3f // ll 456e16, int 11e8
#define MEMINFB 0x7f // ll 919e16, int 21e8
#define MEMINFN 0x80 // ll -810e16, int -19e8
#define INF LLONG_MAX
#define MM <<" "<<
#define endl "\n"
int main(){
ios;
ll i,j,k,n,m,r,c,q;
pll newpt;
cin >> r >> c >>n;
vpll v(n);
fo(i,n){
cin >> j >> k;
v[i] = {j,k};
}
sort(v.begin(),v.end());
cin >> q;
fo(i,q){
bool ans = true;
ll x1,y1,x2,y2;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 > x2 || (x1==x2 && y1 > y2) ) {ans = false;}
else{
pll cur = {x1,y1};
auto it = v.begin();
while (cur.first < x2 ){
it = lower_bound(it,v.end(),cur);
newpt = *it;
// cout << newpt.first MM newpt.second<<endl;
if (newpt.first > cur.first || newpt.second > y2 ) { ans = false; break;}
else cur ={newpt.first+1,newpt.second};
}
}
if (ans) cout <<"Yes"<<endl;
else cout <<"No" <<endl;
}
}
Compilation message
trampoline.cpp: In function 'int main()':
trampoline.cpp:25:16: warning: unused variable 'm' [-Wunused-variable]
25 | ll i,j,k,n,m,r,c,q;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
2 ms |
460 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
2 ms |
332 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
3404 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
67 ms |
3448 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
141 ms |
3444 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
160 ms |
3444 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
177 ms |
4200 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
159 ms |
4036 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
179 ms |
4220 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
168 ms |
4104 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
165 ms |
4088 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
194 ms |
4088 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
400 KB |
5000 token(s): yes count is 3238, no count is 1762 |
2 |
Correct |
7 ms |
332 KB |
5000 token(s): yes count is 3837, no count is 1163 |
3 |
Correct |
4 ms |
332 KB |
5000 token(s): yes count is 4104, no count is 896 |
4 |
Correct |
4 ms |
332 KB |
5000 token(s): yes count is 3934, no count is 1066 |
5 |
Correct |
59 ms |
396 KB |
5000 token(s): yes count is 3384, no count is 1616 |
6 |
Correct |
4 ms |
332 KB |
5000 token(s): yes count is 3390, no count is 1610 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2082 ms |
3448 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |