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 <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
using vi = vector<int>;
#define sz(x) int(x.size())
const int mx = 300'000;
const int inf = 1'0000'0001;
int n, k, q;
vi x(1+mx), t(1+mx), a(1+mx), b(1+mx);
vi l(1+mx), y(1+mx);
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> k >> q;
for(int i = 1; i <= n; i++) cin >> x[i] >> t[i] >> a[i] >> b[i];
for(int j = 1; j <= q; j++) cin >> l[j] >> y[j];
for(int j = 1; j <= q; j++)
{
vi dist(1+k, inf);
for(int i = 1; i <= n; i++)
{
if(a[i] <= y[j] && y[j] <= b[i])
{
dist[t[i]] = min(dist[t[i]], abs(x[i] - l[j]));
}
}
int ans = 0;
for(int z = 1; z <= k; z++) ans = max(ans, dist[z]);
if(ans >= inf)
ans = -1;
cout << ans << '\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... |