Submission #971561

#TimeUsernameProblemLanguageResultExecution timeMemory
971561irmuunNew Home (APIO18_new_home)C++17
5 / 100
5046 ms19052 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,k,q; cin>>n>>k>>q; ll x[n+5],t[n+5],a[n+5],b[n+5]; for(ll i=1;i<=n;i++){ cin>>x[i]>>t[i]>>a[i]>>b[i]; } ll d[k+5]; while(q--){ ll l,y; cin>>l>>y; fill(d+1,d+k+1,1e9); for(ll i=1;i<=n;i++){ if(a[i]<=y&&y<=b[i]){ d[t[i]]=min(d[t[i]],abs(l-x[i])); } } ll ans=0; for(ll i=1;i<=k;i++){ ans=max(ans,d[i]); } if(ans==1e9) ans=-1; cout<<ans<<"\n"; } }
#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...