Submission #920966

# Submission time Handle Problem Language Result Execution time Memory
920966 2024-02-03T08:26:14 Z teacup Trampoline (info1cup20_trampoline) C++14
73 / 100
2000 ms 2800 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<pos.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";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 856 KB 200 token(s): yes count is 21, no count is 179
2 Correct 5 ms 604 KB 200 token(s): yes count is 70, no count is 130
3 Correct 4 ms 348 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 105 ms 2556 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 110 ms 2500 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 223 ms 2544 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 257 ms 2604 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Correct 622 ms 2752 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 631 ms 2792 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 623 ms 2752 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 637 ms 2800 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 629 ms 2752 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 624 ms 2748 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Correct 16 ms 548 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 19 ms 344 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 20 ms 348 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 17 ms 348 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 133 ms 348 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 21 ms 348 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2044 ms 2420 KB Time limit exceeded
2 Halted 0 ms 0 KB -