Submission #365971

#TimeUsernameProblemLanguageResultExecution timeMemory
365971sobaTrampoline (info1cup20_trampoline)C++14
73 / 100
2079 ms13440 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll>v[200001]; int main() { ll r , c , n , x , y , a, b, t; cin >> r>> c >> n ; //cout << r << " " << c << " " << n << "\n"; map<ll,ll>mp; //cout << "haha\n"; ll cnt=1; for(int i = 0 ; i < n ; i++) { cin >> x>> y ; if(!mp[x])mp[x]=cnt++; v[mp[x]].push_back(y); } for(int i =1 ;i < cnt ; i++) { sort(v[i].begin() , v[i].end()); } cin >> t; while(t--) { cin>> x >> y >> a >> b ; if(x==a) { if(y<=b) { cout << "Yes\n"; } else cout << "No\n"; continue; } int j=y; int impos=1; for(int i = x ; i<a ; i++) { if(mp[i]==0) { impos=1; break; } vector<ll>::iterator it = lower_bound(v[mp[i]].begin() , v[mp[i]].end() , j); if(it==v[mp[i]].end()) { j=c+1; } else j=*it; //cout << j << "\n"; if(j>b) { impos=1; break; } if(i==a-1) { impos=0; } } if(impos) { cout << "No\n"; } else cout << "Yes\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...