Submission #522889

#TimeUsernameProblemLanguageResultExecution timeMemory
522889Savu_Stefan_CatalinTrampoline (info1cup20_trampoline)C++14
0 / 100
281 ms25832 KiB
#include <iostream> #include <algorithm> using namespace std; int n,t[25][200005],xs,ys,xf,yf,i,j,test,st; pair<int,int> s[200005]; int cb(int x,int y) { int st=1,dr=n,mij=0,ras=0; while (st<=dr) { mij=(st+dr)/2; if (s[mij].first>x) {dr=mij-1;} else if (s[mij].first<x) {st=mij+1;} else if (s[mij].second<y) {st=mij+1;} else {dr=mij-1; ras=mij;} } return ras; } int ascen(int nod,int lvl) { for (int i=19;i>=0;--i) { if ((1<<i)<=lvl) { nod=t[i][nod]; lvl-=(1<<i); } } return nod; } int main() { ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); cin>>n>>n>>n; for (i=1;i<=n;++i) { cin>>s[i].first>>s[i].second; } sort(s+1,s+n+1); for (i=1;i<=n;++i) { t[0][i]=cb(s[i].first+1,s[i].second); } for (i=1;i<=19;++i) { for (j=1;j<=n;++j) t[i][j]=t[i-1][t[i-1][j]]; } cin>>test; for (i=1;i<=test;++i) { cin>>xs>>ys>>xf>>yf; if (xs==xf) {if (ys<=yf) {cout<<"Yes"<<'\n';} else {cout<<"No"<<'\n';} continue;} if (xf<xs||yf<ys) {cout<<"No"<<'\n'; continue;} st=cb(xs,ys); if (st==0) {cout<<"No";} else if (ascen(st,xf-1-xs)<=yf) {cout<<"Yes";} else {cout<<"No";} cout<<'\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...