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 <bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
int n;
int K;int Q;
int xar[200005];
int typ[200005];
int ta[200005];
int tb[200005];
int ans[200005];
signed main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
cin>>n>>K>>Q;
for(int i=1;i<=n;i++){
cin>>xar[i]>>typ[i]>>ta[i]>>tb[i];
}
while(Q--){
int pl;int t;
cin>>pl>>t;
for(int i=1;i<=K;i++){
ans[i]=1e12;
}
for(int i=1;i<=n;i++){
if(t<ta[i]||t>tb[i]){continue;}
ans[typ[i]]=min(ans[typ[i]],abs(xar[i]-pl));
}
int fans=0;
for(int i=1;i<=K;i++){
fans=max(fans,ans[i]);
}
if(fans>=1e9){fans=-1;}
cout<<fans<<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... |