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;
int main() {
ios::sync_with_stdio(false);
cin.tie(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];
}
vector<int> l(q), y(q);
for (int i = 0; i < q; ++i) {
cin >> l[i] >> y[i];
}
const int INF = 1e9;
for (int i = 0; i < q; ++i) {
vector<int> mn(k, INF);
for (int j = 0; j < n; ++j) {
if (y[i] >= a[j] && y[i] <= b[j]) {
mn[t[j]] = min(mn[t[j]], abs(l[i] - x[j]));
}
}
if (*max_element(mn.begin(), mn.end()) == INF) {
cout << "-1" << endl;
} else {
cout << *max_element(mn.begin(), mn.end()) << 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... |