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 N = 3e5 + 5;
int n, k, q, x[N], t[N], a[N], b[N], type[N], l, r;
int main () {
// freopen ("input.txt", "r", stdin);
cin >> n >> k >> q;
for (int i = 1; i <= n; ++i) {
cin >> x[i] >> t[i] >> a[i] >> b[i];
}
while ( q-- ) {
cin >> l >> r;
for (int i = 1; i <= k; ++i) {
type[i] = -1;
}
for (int i = 1; i <= n; ++i) {
if (a[i] <= r and r <= b[i]) {
if (type[t[i]] == -1) {
type[t[i]] = abs (l - x[i]);
}
else {
type[t[i]] = min (type[t[i]], abs (l - x[i]));
}
}
}
int jog = 0;
for (int i = 1; i <= k; ++i) {
jog = max (jog, type[i]);
if (type[i] == -1) {
jog = -1;
break;
}
}
cout << jog << "\n";
}
}
# | 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... |