This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |