Submission #545423

#TimeUsernameProblemLanguageResultExecution timeMemory
545423valerikkNew Home (APIO18_new_home)C++17
5 / 100
5047 ms7740 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k, q; cin >> n >> k >> q; vector<int> x(n), t(n), a(n), b(n); for (int i = 0; i < n; ++i) { cin >> x[i] >> t[i] >> a[i] >> b[i]; --t[i]; } vector<int> l(q), y(q); for (int i = 0; i < q; ++i) { cin >> l[i] >> y[i]; } const int INF = 1e9; for (int i = 0; i < q; ++i) { vector<int> mn(k, INF); for (int j = 0; j < n; ++j) { if (y[i] >= a[j] && y[i] <= b[j]) { mn[t[j]] = min(mn[t[j]], abs(l[i] - x[j])); } } if (*max_element(mn.begin(), mn.end()) == INF) { cout << "-1" << endl; } else { cout << *max_element(mn.begin(), mn.end()) << endl; } } 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...