Submission #1087304

# Submission time Handle Problem Language Result Execution time Memory
1087304 2024-09-12T13:21:29 Z Tesla89 Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
#define int long long
#define endl '\n'

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    int a[n+2],b[n+1];
    int pref[n+1],suf[n+2];
    suf[n+1]=pref[0]=0;
    for(int i=1;i<=n+1;i++)cin>>a[i];
    for(int i=1;i<=n;i++)cin>>b[i];
    sort(a+1,a+n+2);
    sort(b+1,b+n+1);
    for(int i=1;i<=n;i++)pref[i]=max(pref[i-1],a[i]-b[i]);
    for(int i=n;i>=1;i--)suf[i]=max(suf[i+1],a[i+1]-b[i]);
    for(int i=1;i<=n+1;i++)cout<<max(pref[i-1],suf[i])<<" ";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -