Submission #1135311

#TimeUsernameProblemLanguageResultExecution timeMemory
1135311MunkhturErdenebatJust Long Neckties (JOI20_ho_t1)C++20
100 / 100
267 ms22536 KiB
#include<bits/stdc++.h> #include<string.h> #include <algorithm> #include <stdlib.h> #define ll long long using namespace std; ll a,b,c,d,e,f,m[200005],i,j,n,h,g,l,r,ka,p,q[200005],t[200005]; map<ll,ll> maa,mii,mee; vector<ll> vas[25],vis,vii; pair<ll,ll> k[200006]; int main(){ cin>>a; for(i=1 ; i<=a+1 ; i++){ cin>>k[i].first; k[i].second=i; } sort(k+1,k+a+2); for(j=1 ; j<=a ; j++){ cin>>t[j]; } sort(t+1,t+a+1); for(i=1 ; i<=a ; i++){ q[i]=max(q[i-1],k[i].first-t[i]); } for(i=a ; i>=1 ; i--){ m[i]=max(m[i+1],k[i+1].first-t[i]); } for(i=1 ; i<=a+1 ; i++){ maa[k[i].second]=max(q[i-1],m[i]); } for(i=1 ; i<=a+1 ; i++){ cout<<maa[i]<<" "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...