Submission #698681

#TimeUsernameProblemLanguageResultExecution timeMemory
698681vjudge1New Home (APIO18_new_home)C++17
5 / 100
11 ms1756 KiB
#include <bits/stdc++.h> #define endl '\n' #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define int ll #define all(vec) vec.begin(), vec.end() typedef long long ll; using namespace std; const int N = 410, mod = 1e9 + 7; struct st{ int x, t, a, b; }; int n, k, q; vector<st> v(N); signed main() { FAST; cin >> n >> k >> q; for(int i = 1; i <= n; i++) { cin >> v[i].x >> v[i].t >> v[i].a >> v[i].b; } while(q--) { int l, y; cin >> l >> y; int ans[k+1]; for(int i = 1; i <= k; i++) ans[i] = INT_MAX; for(int i = 1; i <= n; i++) { if(v[i].a <= y && v[i].b >= y) { ans[v[i].t] = min(ans[v[i].t], abs(v[i].x - l)); } } int fin = 0; for(int i = 1; i <= k; i++) { fin = max(fin, ans[i]); } if(fin == INT_MAX) cout << -1 << endl; else cout << fin << endl; } }
#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...