Submission #59865

#TimeUsernameProblemLanguageResultExecution timeMemory
59865dukati8New Home (APIO18_new_home)C++14
5 / 100
5086 ms59260 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a; i<int(b); i++) int main() { int n,q,k; cin >> n >> k >> q; vector<vector<int> > stores(n); rep (i,0,n) { int x,t,a,b; cin >> x >> t >> a >> b; stores[i]={x,t,a,b}; } vector< pair<int,int> > queries(q); rep (i,0,q) { int l,y; cin >> l >> y; queries[i]=make_pair(l,y); } vector <set < vector<int> > > types(k); rep (i,0,n) { int t=stores[i][1]-1; types[t].insert(stores[i]); } rep (i,0,q) { int dist=0; int l,y; l=queries[i].first; y=queries[i].second; rep (i,0,k) { int mindist=1e9; for (auto a:types[i]) { if (a[2]<=y && a[3]>=y) mindist=min(mindist,abs(a[0]-l)); } dist=max(dist,mindist); } if (dist==1e9) cout << -1 << endl; else cout << dist << 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...