Submission #743513

#TimeUsernameProblemLanguageResultExecution timeMemory
743513alvingogoNew Home (APIO18_new_home)C++14
0 / 100
5099 ms16540 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define AquA cin.tie(0);ios_base::sync_with_stdio(0); #define fs first #define sc second #define p_q priority_queue #define int long long using namespace std; typedef pair<int,int> pii; signed main(){ AquA; int n,k,q; cin >> n >> k >> q; vector<pair<pii,pii> > vp(n); vector<int> val(k,1e9); for(int i=0;i<n;i++){ cin >> vp[i].fs.fs >> vp[i].fs.sc >> vp[i].sc.fs >> vp[i].sc.sc; vp[i].fs.sc--; } for(int i=0;i<q;i++){ int l,y; cin >> l >> y; fill(val.begin(),val.end(),1e9); for(int j=0;j<n;j++){ if(vp[j].sc.fs<=y && vp[j].sc.sc>=y){ val[vp[j].fs.sc]=min(val[vp[j].fs.sc],abs(l-vp[j].fs.fs)); } } int ans=0; for(int j=0;j<k;j++){ ans=max(ans,val[j]); } cout << ans << "\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...