Submission #383161

# Submission time Handle Problem Language Result Execution time Memory
383161 2021-03-28T23:48:40 Z ScarletS Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 364 KB
#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+2],b[n+1];
    vector<int> p(n+2,0),s(n+2,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)
    {
        p[i] = abs(b[i]-a[i+1]);
        s[i+1] = abs(b[i]-a[i]);
    }
    for (int i=n;i>0;--i)
        p[i]=max(p[i],p[i+1]);
    for (int i=2;i<=n+1;++i)
        s[i]=max(s[i],s[i-1]);
    for (int i=1;i<=n+1;++i)
        cout<<max(p[i],s[i])<<" ";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -