Submission #698809

#TimeUsernameProblemLanguageResultExecution timeMemory
698809vjudge1New Home (APIO18_new_home)C++17
5 / 100
5098 ms33660 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define endl '\n' using namespace std; using namespace __gnu_pbds; using ordered_set = tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>; signed main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n,k,q; cin>>n>>k>>q; map<int,vector<pair<int,pair<int,int>>>>mp; for(int i=0;i<n;i++){ int a,b,c,d; cin>>a>>b>>c>>d; mp[a].push_back({b,{c,d}}); } while(q--){ int a,b; cin>>a>>b; vector<int>vct(k+1,INT_MAX); for(auto &i:mp){ for(auto &w:i.second){ if(b>=w.second.first&&b<=w.second.second){ vct[w.first]=min(vct[w.first],abs(a-i.first)); } } } int g=0; for(int i=1;i<=k;i++)g=max(g,vct[i]); cout<<(g==INT_MAX?-1:g)<<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...