#include <bits/stdc++.h>
using namespace std;
int r,c,n;
map <int,vector<int> > arr1;
map <int,vector<int> > arr2;
bool fun(int a,int b,int x,int y){
if(a>x||b>y){return false;}
if(a==x){return true;}
int lim=y;
for(int i=x-1;i>=a;i--){
if(arr1[i].size()==0){return false;}
for(int j=0;j<arr1[i].size();j++){
if(arr1[i][j]<=lim){
if(arr1[i][j]>=b){
if(i==a){return true;}
lim==arr1[i][j];
break;
}
else{return false;}
}
if(j==arr1[i].size()-1){return false;}
}
}
}
int main() {
int a,b,x,y;
cin>>r>>c>>n;
for(int i=0;i<n;i++){
cin>>a>>b;
arr1[a].push_back(b);
arr2[b].push_back(a);
}
map<int,vector<int> > :: iterator it=arr1.begin();
for( ;it != arr1.end();it++){
sort(arr1[it->first].begin(),arr1[it->first].end(),greater<int>());
}
int t;
cin>>t;
for(int i=0;i<t;i++){
cin>>a>>b>>x>>y;
if(fun(a,b,x,y)){cout<<"Yes"<<endl;}
else{cout<<"No"<<endl;}
}
return 0;
}
Compilation message
trampoline.cpp: In function 'bool fun(int, int, int, int)':
trampoline.cpp:13:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
13 | for(int j=0;j<arr1[i].size();j++){
| ~^~~~~~~~~~~~~~~
trampoline.cpp:17:24: warning: value computed is not used [-Wunused-value]
17 | lim==arr1[i][j];
trampoline.cpp:22:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | if(j==arr1[i].size()-1){return false;}
| ~^~~~~~~~~~~~~~~~~~
trampoline.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
25 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
492 KB |
expected NO, found YES [2nd token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2080 ms |
3888 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2087 ms |
23268 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
48 ms |
876 KB |
expected NO, found YES [235th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2071 ms |
31340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |