Submission #836675

# Submission time Handle Problem Language Result Execution time Memory
836675 2023-08-24T13:53:11 Z 12345678 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=2e5+5;
int n, a[nx], b[nx], ans[nx], mx;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n+1; i++) cin>>a[i];
    for (int i=1; i<=n; i++) cin>>b[i];
    sort(b+1, b+n+1);
    sort(a+1, a+n+2);
    for (int i=1; i<=n; i++) mx=max(mx, a[i]-b[i]);
    ans[n+1]=mx;
    for (int i=n; i>=1; i--) mx=max(mx, a[i+1]-b[i]), ans[i]=mx;
    for (int i=1; i<=n+1; i++) cout<<ans[i]<<' ';
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -