Submission #160544

#TimeUsernameProblemLanguageResultExecution timeMemory
160544MinnakhmetovNew Home (APIO18_new_home)C++14
5 / 100
6 ms632 KiB
#include <bits/stdc++.h> #define ll long long #define all(aaa) aaa.begin(), aaa.end() using namespace std; const int N = 405, INF = 1e9; struct Store { int x, t, a, b; } s[N]; int mn[N]; signed main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n, k, q; cin >> n >> k >> q; for (int i = 0; i < n; i++) { cin >> s[i].x >> s[i].t >> s[i].a >> s[i].b; s[i].t--; } for (int i = 0; i < q; i++) { fill(mn, mn + k, INF); int x, y; cin >> x >> y; for (int j = 0; j < n; j++) { if (s[j].a <= y && y <= s[j].b) { mn[s[j].t] = min(mn[s[j].t], abs(s[j].x - x)); } } int ans = *max_element(mn, mn + k); if (ans == INF) cout << "-1\n"; else cout << 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...