Submission #950832

#TimeUsernameProblemLanguageResultExecution timeMemory
950832MinaRagy06New Home (APIO18_new_home)C++17
5 / 100
5098 ms17864 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int inf = 1e9; int main() { ios_base::sync_with_stdio(0), cin.tie(0); int n, k, q; cin >> n >> k >> q; array<int, 4> a[n]; for (int i = 0; i < n; i++) { cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3]; } while (q--) { int l, y; cin >> l >> y; vector<int> v[k + 1]; for (int i = 0; i < n; i++) { if (a[i][2] <= y && y <= a[i][3]) { v[a[i][1]].push_back(a[i][0]); } } int mx = 0; for (int i = 1; i <= k; i++) { int mn = inf; for (auto j : v[i]) { mn = min(mn, abs(l - j)); } mx = max(mx, mn); } if (mx == inf) { cout << "-1\n"; } else { cout << mx << '\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...