Submission #743514

#TimeUsernameProblemLanguageResultExecution timeMemory
743514alvingogoNew Home (APIO18_new_home)C++14
5 / 100
5050 ms10208 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]); } if(ans>5e8){ cout << -1 << "\n"; continue; } 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...