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
signed main(){
int N,K,Q;
cin>>N>>K>>Q;
vector<int> X(N),T(N),A(N),B(N);
for(int i=0;i<N;i++){
cin>>X[i]>>T[i]>>A[i]>>B[i];
T[i]--;
}
while(Q--){
int x,t;
cin>>x>>t;
vector<int> S(K,1e18);
for(int i=0;i<N;i++){
if(A[i] > t || B[i] < t) continue;
S[T[i]] = min(S[T[i]],abs(X[i]-x));
}
sort(S.rbegin(),S.rend());
cout<<(S[0] == 1e18 ? -1 : S[0])<<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... |