Submission #252430

#TimeUsernameProblemLanguageResultExecution timeMemory
252430SaboonNew Home (APIO18_new_home)C++14
5 / 100
5097 ms6388 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 3e5 + 20; const int mod = 1e9 + 7; int x[maxn], t[maxn], a[maxn], b[maxn]; int mn[maxn]; int main(){ ios_base::sync_with_stdio(false); int n, k, q; cin >> n >> k >> q; for (int i = 1; i <= n; i++) cin >> x[i] >> t[i] >> a[i] >> b[i]; for (int i = 1; i <= q; i++){ int l, y; cin >> l >> y; memset(mn, -1, sizeof mn); for (int j = 1; j <= n; j++){ if (y < a[j] or b[j] < y) continue; if (mn[t[j]] == -1 or mn[t[j]] > abs(l-x[j])) mn[t[j]] = abs(l-x[j]); } if (*min_element(mn+1, mn+k+1) == -1) cout << -1 << '\n'; else cout << *max_element(mn+1, mn+k+1) << '\n'; } }
#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...