Submission #945970

#TimeUsernameProblemLanguageResultExecution timeMemory
945970thelegendary08New Home (APIO18_new_home)C++14
5 / 100
5070 ms29588 KiB
#include<bits/stdc++.h> #define vi vector<int> #define vll vector<long long int> #define vpii vector<pair<int,int>> #define vpll vector<pair<long long int, long long int>> #define pb push_back #define f0r(i,n) for(int i = 0;i<n;i++) using namespace std; typedef long long int ll; int main(){ int n,k,q; cin>>n>>k>>q; vector<vector<ll>>v[k]; f0r(i,n){ ll x,t,a,b; cin>>x>>t>>a>>b; v[--t].pb({x,a,b}); } while(q--){ ll loc, time; cin>>loc>>time; ll inc = 0; f0r(i,k){ ll mn = 4e18; for(auto u : v[i]){ //cout<<u[2]<<' '<<u[1]<<'\n'; if(time <= u[2] && time >= u[1])mn = min(mn, abs(loc - u[0])); } //cout<<mn<<'\n'; if(mn == 4e18){ inc = -1; break; } else inc = max(inc, mn); } cout<<inc<<'\n'; } }
#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...