제출 #918750

#제출 시각아이디문제언어결과실행 시간메모리
918750AiperiiiJust Long Neckties (JOI20_ho_t1)C++14
100 / 100
298 ms19536 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n; cin>>n; vector <int> a(n+1),b(n),v(n+1); for(int i=0;i<=n;i++){ cin>>a[i];v[i]=a[i]; } for(int i=0;i<n;i++)cin>>b[i]; sort(all(b));sort(all(a)); int mx=0; for(int i=0;i<n;i++){ mx=max(mx,a[i]-b[i]); } map <int,int> ans; ans[a.back()]=mx; for(int i=n;i>=1;i--){ mx=max(mx,a[i]-b[i-1]); ans[a[i-1]]=mx; } for(int i=0;i<=n;i++){ cout<<ans[v[i]]<<" "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...