Submission #567945

#TimeUsernameProblemLanguageResultExecution timeMemory
567945BadPenaltyNew Home (APIO18_new_home)C++14
5 / 100
5081 ms10244 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second #define pb push_back #define endl '\n' #define all(x) x.begin(),x.end() #define yes cout<<"Yes"<<endl #define no cout<<"No"<<endl const int N = 1e6,mod = 1e9+7; ll X[N]; ll A[N]; ll B[N]; ll K[N]; ll ans[N]; int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n,q,k; cin>>n>>k>>q; for(int i = 0;i<n;i++) { cin>>X[i]; cin>>K[i]; cin>>A[i]; cin>>B[i]; } while(q--) { ll x,t; cin>>x>>t; for(int i = 1;i<=k;i++) ans[i] = 1e18; for(int i = 0;i<n;i++) { if(A[i]<=t&&B[i]>=t) { ans[K[i]] = min(ans[K[i]],abs(x-X[i])); // cout<<i<<" "; // cout<<K[i]<<':'<<' '<<abs(x-X[i])<<endl; } } ll out = 0; for(int i = 1;i<=k;i++) out=max(ans[i],out); if(out>=1e18) out = -1; cout<<out<<endl; } 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...