답안 #1010169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1010169 2024-06-28T12:20:28 Z LCJLY Trampoline (info1cup20_trampoline) C++14
0 / 100
2000 ms 11368 KB
#include <bits/stdc++.h>
using namespace std;
	
#define int long long 
#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef array<int,3>pi2;

void solve(){	
	int n,m,k;
	cin >> n >> m >> k;
	
	pii arr[k];
	unordered_map<int,vector<int>>mp;
	for(int x=0;x<k;x++){
		cin >> arr[x].first >> arr[x].second;
		mp[arr[x].first].push_back(arr[x].second);
	}
	
	for(auto &it:mp){
		sort(it.second.begin(),it.second.end());
	}
	
	int q;
	cin >> q;
	pii st,ed;
	
	for(int x=0;x<q;x++){
		cin >> st.first >> st.second >> ed.first >> ed.second;
		
		int cur=st.second;
		bool amos=true;
		if(st.first>ed.second) amos=false;
		for(int y=st.first;y<ed.first;y++){
			int index=lower_bound(mp[y].begin(),mp[y].end(),cur)-mp[y].begin();
			if(index>=(int)mp[y].size()){
				amos=false;
				break;
			}
			cur=mp[y][index];
		}
		
		if(amos&&cur<=ed.second){
			cout << "Yes\n";
		}
		else cout << "No\n";
	}

}
 
int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin >> t;
	//freopen("in.txt","w",stdout);
	while(t--){
		solve();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 856 KB expected NO, found YES [27th token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 44 ms 6624 KB expected YES, found NO [12th token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 104 ms 6084 KB expected YES, found NO [4th token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 604 KB expected YES, found NO [1st token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2059 ms 11368 KB Time limit exceeded
2 Halted 0 ms 0 KB -