제출 #1173398

#제출 시각아이디문제언어결과실행 시간메모리
1173398MuhammetNew Home (APIO18_new_home)C++20
5 / 100
5092 ms7796 KiB
#include "bits/stdc++.h"

using namespace std;
 
#define ll long long
#define SZ(s) (int)s.size()

const int N = 2e5 + 5;
const int M = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int n, k, q;
    cin >> n >> k >> q;

    vector <int> x(n+1), t(n+1), a(n+1), b(n+1);
    for(int i = 1; i <= n; i++) {
        cin >> x[i] >> t[i] >> a[i] >> b[i];
    }

    vector <int> l(q+1), y(q+1), c;
    for(int i = 1; i <= q; i++) {
        cin >> l[i] >> y[i];
        c.assign(k+1, 1e9);
        for(int j = 1; j <= n; j++) {
            if(a[j] <= y[i] and y[i] <= b[j]) {
                c[t[j]] = min(c[t[j]], abs(x[j] - l[i]));
            }
        }
        int ans = 0;
        for(int j = 1; j <= k; j++) {
            ans = max(ans, c[j]);
        }
        cout << (ans == 1e9 ? -1 : ans) << '\n';
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...