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>
typedef long long ll;
typedef long double ld;
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
#define int ll
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k, q;
cin >> n >> k >> q;
vector<int> x(n), type(n), l(n), r(n);
for (int i = 0; i < n; i++) {
cin >> x[i] >> type[i] >> l[i] >> r[i];
type[i]--;
}
vector<int> best(k);
for (int i = 0; i < q; i++) {
int pos, tt;
cin >> pos >> tt;
fill(all(best), 1e9);
for (int j = 0; j < n; j++) {
if (tt >= l[j] && tt <= r[j]) {
best[type[j]] = min(best[type[j]], abs(pos - x[i]));
}
}
int rez = 0;
for (int j = 0; j < k; j++) {
rez = max(rez, best[j]);
}
if (rez == 1e9) {
cout << -1 << '\n';
}
else {
cout << rez << '\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... |