Submission #203713

#TimeUsernameProblemLanguageResultExecution timeMemory
203713SegtreeNew Home (APIO18_new_home)C++14
5 / 100
8 ms508 KiB
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<n;i++) #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) #define N 410 ll n,q,k; ll x[N],t[N],a[N],b[N]; int main(){ cin>>n>>k>>q; rep(i,n){ cin>>x[i]>>t[i]>>a[i]>>b[i]; t[i]--; } rep(u,q){ ll l,y; cin>>l>>y; ll mi[410]; rep(i,k)mi[i]=1e17; rep(i,n){ if(a[i]<=y&&y<=b[i]){ chmin(mi[t[i]],abs(l-x[i])); } } ll ma=0; rep(i,k)chmax(ma,mi[i]); if(ma==1e17)ma=-1; cout<<ma<<endl; } }
#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...