Submission #920961

#TimeUsernameProblemLanguageResultExecution timeMemory
920961teacupTrampoline (info1cup20_trampoline)C++14
0 / 100
2058 ms2748 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; vector<ii> V; int check(int x1, int y1, int x2, int y2){ if (x1>x2||y1>y2) return false; if (x1==x2) return true; int curx=x1, cury=y1; while (x1 <= x2 && y1 <= y2){ // find a green ii pos=*lower_bound(V.begin(),V.end(),ii({curx,cury})); //cout<<"Curr: "<<curx<<" "<<cury<<"\n"; //cout<<"Green: "<<pos.first<<" "<<pos.second<<"\n"; // no greens left in row = screwed if (curx!=pos.first) return false; // assume verticaling if (pos.first+1==x2) return true; curx=pos.first+1; cury=pos.second; //cout<<"Curr: "<<curx<<" "<<cury<<"\n"; } return false; } int main(){ int R, C, N; cin>>R>>C>>N; for (int i=0; i<N; i++){ int a,b; cin>>a>>b; V.push_back(ii({a,b})); } sort(V.begin(), V.end()); int K; cin>>K; while (K--){ int x1,x2,y1,y2; cin>>x1>>y1>>x2>>y2; if (check(x1,y1,x2,y2)) cout<<"Yes\n"; else cout<<"No\n"; } }
#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...