제출 #383162

#제출 시각아이디문제언어결과실행 시간메모리
383162ScarletSJust Long Neckties (JOI20_ho_t1)C++17
0 / 100
1 ms364 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin>>n; int a[n+1],b[n]; vector<int> p(n+1,0),s(n+1,0); for (int i=0;i<n+1;++i) cin>>a[i]; for (int i=0;i<n;++i) cin>>b[i]; sort(a,a+n+1); sort(b,b+n); for (int i=0;i<n;++i) { p[i] = abs(b[i]-a[i+1]); s[i+1] = abs(b[i]-a[i]); } for (int i=n-1;i>=0;--i) p[i]=max(p[i],p[i+1]); for (int i=1;i<=n;++i) s[i]=max(s[i],s[i-1]); for (int i=0;i<=n;++i) cout<<max(p[i],s[i])<<" "; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...