Submission #784300

#TimeUsernameProblemLanguageResultExecution timeMemory
7843001075508020060209tcNew Home (APIO18_new_home)C++14
5 / 100
5044 ms18764 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second int n; int K;int Q; int xar[200005]; int typ[200005]; int ta[200005]; int tb[200005]; int ans[200005]; signed main() { cin.tie(0); ios_base::sync_with_stdio(0); cin>>n>>K>>Q; for(int i=1;i<=n;i++){ cin>>xar[i]>>typ[i]>>ta[i]>>tb[i]; } while(Q--){ int pl;int t; cin>>pl>>t; for(int i=1;i<=K;i++){ ans[i]=1e12; } for(int i=1;i<=n;i++){ if(t<ta[i]||t>tb[i]){continue;} ans[typ[i]]=min(ans[typ[i]],abs(xar[i]-pl)); } int fans=0; for(int i=1;i<=K;i++){ fans=max(fans,ans[i]); } if(fans>=1e9){fans=-1;} cout<<fans<<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...