Submission #946042

#TimeUsernameProblemLanguageResultExecution timeMemory
946042yhkhooNew Home (APIO18_new_home)C++17
5 / 100
5051 ms13868 KiB
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; int main(){ cin.tie(0); ios_base::sync_with_stdio(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]--; } while(q--){ int l, y; cin >> l >> y; vector<int> ic(k, INF); for(int i=0; i<n; i++){ if(a[i] <= y && y <= b[i]){ ic[t[i]] = min(ic[t[i]], abs(x[i] - l)); } } auto ddd = max_element(ic.begin(), ic.end()); if(*ddd == INF){ *ddd = -1; } cout << *ddd << '\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...