답안 #893124

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
893124 2023-12-26T14:30:04 Z jellybean Trampoline (info1cup20_trampoline) C++17
73 / 100
2000 ms 15952 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
vector<int>arr[2505];
pair<int,int>arr1[200005];
 
signed main(){
	ios::sync_with_stdio(0); cin.tie(0);
	
	int r,c,n; cin>>r>>c>>n;
	
	/*if(r<=2500 and c<=2500){
		for(int i=0; i<n; i++){
			int a,b; cin>>a>>b;
			arr[a].push_back(b); //row a has a green tramp at b
		}
		for(int i=0; i<2505; i++) sort(arr[i].begin(), arr[i].end());
		
		int t; cin>>t;
		while(t--){
			int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2;
			if(x2<x1) {cout<<"No\n"; continue;}
			int row=x1, col=y1;
			bool f=0;
			while(row!=x2){
				auto it = lower_bound(arr[row].begin(), arr[row].end(), col);
				if(it==arr[row].end()){f=1; cout<<"No\n"; break;}
				col = *it;
				row++;
			}
			if(f) continue;
			if(y2<col) cout<<"No\n";
			else cout<<"Yes\n";
		}
		return 0;
	} */
	
	for(int i=0; i<n; i++) cin>>arr1[i].first>>arr1[i].second;
	sort(arr1, arr1+n);
	//for(int i=0;i<n; i++) cout<<arr1[i].first<<" "<<arr1[i].second<<"\n";
	int t; cin>>t;
	while(t--){
		int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2;
		int row=x1, col=y1;
		bool f=0;
		pair<int,int> p = {row,col};
		while(row!=x2){
			auto it = lower_bound(arr1, arr1+n, p);
			if(it==arr1+n){cout<<"No\n"; f=1; break;}
			p = *it;
			if(p.first != row or p.second > y2){cout<<"No\n"; f=1; break;}
			row++; p.first=row;
		}
		if(f) continue;
		if(p.second>y2) cout<<"No\n";
		else cout<<"Yes\n";
	}
		
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 600 KB 200 token(s): yes count is 21, no count is 179
2 Correct 2 ms 604 KB 200 token(s): yes count is 70, no count is 130
3 Correct 2 ms 604 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 52 ms 5464 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 52 ms 5468 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 177 ms 4956 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 206 ms 5456 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 15920 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 136 ms 15952 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 135 ms 15696 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 149 ms 15828 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 147 ms 15784 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 140 ms 15700 KB 200000 token(s): yes count is 97163, no count is 102837
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 860 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 7 ms 860 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 4 ms 860 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 4 ms 904 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 113 ms 884 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 4 ms 860 KB 5000 token(s): yes count is 3390, no count is 1610
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2025 ms 7708 KB Time limit exceeded
2 Halted 0 ms 0 KB -