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;
const int INF = 1e9;
int main(){
cin.tie(0); ios_base::sync_with_stdio(0);
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 l, y;
cin >> l >> y;
vector<int> ic(k, INF);
for(int i=0; i<n; i++){
if(a[i] <= y && y <= b[i]){
ic[t[i]] = min(ic[t[i]], abs(x[i] - l));
}
}
auto ddd = max_element(ic.begin(), ic.end());
if(*ddd == INF){
*ddd = -1;
}
cout << *ddd << '\n';
}
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... |