Submission #250900

#TimeUsernameProblemLanguageResultExecution timeMemory
250900akarinkofNew Home (APIO18_new_home)C++14
5 / 100
5054 ms21896 KiB
#include<bits/stdc++.h> #include<iostream> #define rep(i,n) for(int i=0;i<n;++i) #define rrep(i,n) for(int i=n-1;i>=0;--i) #define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} #define MAX_N 1002 #define i197 1000000007 using namespace std; typedef long long ll; typedef pair<ll,ll> P1; typedef pair<int,int> Pi; typedef pair<double,Pi> Pdi; typedef pair<ll,int>Pli; typedef pair<P1,ll> P2; typedef pair<string,string> Ps; const ll INF=1000000000000000001; struct edge{int to,cost;}; int dy[]={0, 0, 1, -1}; int dx[]={1, -1, 0, 0}; struct Road{double cost;int a,b;}; struct pos{ // 1 変数を入れる; int x,y,sx,sy,cost; }; ll x[300001],t[300001],a[300001],b[300001]; ll l[300001],y[300001]; int main() { ll n,k,q; cin>>n>>k>>q; rep(i,n)cin>>x[i]>>t[i]>>a[i]>>b[i]; rep(i,q){ cin>>l[i]>>y[i]; int f[300001]={}; ll ma[300001]={}; ll mi=0; ll z=0; rep(j,n){ if(a[j]<=y[i]&&y[i]<=b[j]){ if(f[t[j]]==0){ ma[t[j]]=abs(x[j]-l[i]); f[t[j]]=1; z++; } ma[t[j]]=min(abs(x[j]-l[i]),ma[t[j]]); } } rep(s,k)mi=max(mi,ma[s+1]); if(z!=k)cout<<"-1"<<endl; else cout<<mi<<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...