Submission #920964

# Submission time Handle Problem Language Result Execution time Memory
920964 2024-02-03T08:25:57 Z teacup Trampoline (info1cup20_trampoline) C++14
Compilation error
0 ms 0 KB
#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||y2<post.second) 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";
	}
}

Compilation message

trampoline.cpp: In function 'int check(int, int, int, int)':
trampoline.cpp:15:27: error: 'post' was not declared in this scope; did you mean 'pos'?
   15 |   if (curx!=pos.first||y2<post.second) return false;
      |                           ^~~~
      |                           pos