This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
Author : DeMen100ns (a.k.a Vo Khac Trieu)
School : VNU-HCM High school for the Gifted
fuck you adhoc
*/
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int N = 3e5 + 5;
const long long INF = 1e18 + 7;
const int MAXA = 1e9;
const int B = sqrt(N) + 5;
array<int, 4> a[N];
array<int, 3> qu[N];
int dist[N];
void solve()
{
int n, k, q; cin >> n >> k >> q;
for(int i = 1; i <= n; ++i){
int x, t, l, r; cin >> x >> t >> l >> r;
a[i] = {x, t, l, r};
}
for(int i = 1; i <= q; ++i){
int l, y; cin >> l >> y;
for(int j = 1; j <= k; ++j){
dist[j] = MAXA;
}
for(int i = 1; i <= n; ++i){
int x = a[i][0], t = a[i][1], l = a[i][2], r = a[i][3];
if (l <= y && y <= r){
dist[t] = min(dist[t], abs(x - l));
}
}
int ans = 0;
for(int j = 1; j <= k; ++j){
ans = max(ans, dist[j]);
}
if (ans == MAXA) ans = -1;
cout << ans << endl;
}
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("codeforces.inp","r",stdin);
// freopen("codeforces.out","w",stdout);
int t = 1; // cin >> t;
while (t--)
{
solve();
}
}
# | 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... |