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;
typedef long long ll;
const int N = 1e6 + 5, MOD = 998244353;
int n,q,k;
vector<array<int,4>> a(N);
void test(){
cin >> n >> k >> q;
for(int i = 1;i <= n;i++){
cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
}
for(int i = 1;i <= q;i++){
int y,l;
cin >> l >> y;
int res = 0;
for(int j = 1;j <= k;j++){
int mn = 1e9;
for(int x = 1;x <= n;x++){
if(a[x][1] == j && a[x][2] <= y && a[x][3] >= y){
mn = min(mn,abs(a[x][0] - l));
}
}
if(mn == 1e9){
res=-1;
break;
}
res = max(res,mn);
}
cout << res << '\n';
}
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int T = 1;
// cin >> T;
while (T--){
test();
}
}
# | 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... |