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>
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()
using namespace std;
const int N = 405, INF = 1e9;
struct Store {
int x, t, a, b;
} s[N];
int mn[N];
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n, k, q;
cin >> n >> k >> q;
for (int i = 0; i < n; i++) {
cin >> s[i].x >> s[i].t >> s[i].a >> s[i].b;
s[i].t--;
}
for (int i = 0; i < q; i++) {
fill(mn, mn + k, INF);
int x, y;
cin >> x >> y;
for (int j = 0; j < n; j++) {
if (s[j].a <= y && y <= s[j].b) {
mn[s[j].t] = min(mn[s[j].t], abs(s[j].x - x));
}
}
int ans = *max_element(mn, mn + k);
if (ans == INF)
cout << "-1\n";
else
cout << ans << "\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... |