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 fast ios_base::sync_with_stdio();cin.tie();cout.tie();
#define en cout<<endl;
#define ops cout<<"ops"<<endl;
#define line cout<<"---------------------------"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pllll;
typedef string str;
const ll DIM = 4e2 + 7;
const ll DIMM = 1e2 + 7;
const ll DDIM = 7;
const ll INF = 1e18 + 7;
const ll X = 1e5 + 7;
const ll BS = 2e5 + 7;
const ll AS = 26 + 7;
const ll MODULO = 1e9 + 7;
ll nt,n,m,k,q;
ll val,val1;
ll x,type,t1,t2;
ll ye;
struct z{
ll x,t1,t2;
};
vector<z> a[DIM];
ll cres,res;
int main()
{
fast;
//ll x1,y1,x2,y2;
cin>>n>>m>>k;
for(int i=1;i<=n;i++){
cin>>x>>type>>t1>>t2;
a[type].push_back({x,t1,t2});
}
for(int j=1;j<=k;j++){
cin>>x>>ye;
res=0;
for(int i=1;i<=m;i++){
cres=INF;
for(auto v:a[i]){
if(v.t1>ye || ye>v.t2)continue;
cres=min(cres,abs(x-v.x));
}
res=max(res,cres);
}
if(res==INF)cout<<-1<<endl;
else cout<<res<<endl;
}
return 0;
}
# | 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... |