제출 #1353181

#제출 시각아이디문제언어결과실행 시간메모리
1353181javkhlantogsNew Home (APIO18_new_home)C++20
0 / 100
5095 ms38508 KiB
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
	ll n,k,q,i,j;
	cin>>n>>k>>q;
	vector<vector<ll>> s(n,vector<ll>(4));
	for(i=0 ; i<n ; i++){
		for(j=0 ; j<4 ; j++){
			cin>>s[i][j];
		}
	}
	vector<vector<ll>> x(q,vector<ll>(2));
	for(i=0 ; i<q ; i++){
		for(j=0 ; j<2 ; j++){
			cin>>x[i][j];
		}
		ll ans=0;
		vector<ll> cnt(k+1,0);
		for(j=0 ; j<n ; j++){
			if(s[j][2]<=x[i][1] and x[i][1]<=s[j][3]){
				cnt[s[j][1]]++;
				ans=max(ans,abs(x[i][0]-s[j][0]));
			}
		}
		bool chck=1;
		for(j=1 ; j<=k ; j++) if(cnt[j]==0) chck=0;
		if(chck) cout<<ans<<"\n";
			else cout<<-1<<"\n";
	}
	return 0;
}
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...