Submission #871129

# Submission time Handle Problem Language Result Execution time Memory
871129 2023-11-10T01:39:02 Z Marco_Escandon Just Long Neckties (JOI20_ho_t1) C++11
0 / 100
0 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll cad[n+1],cad2[n];
    for(int i=0; i<n+1; i++)
        cin>>cad[i];
    for(int j=0; j<n; j++)
        cin>>cad2[j];
    sort(cad,cad+n+1);
    sort(cad2,cad2+n);
    ll ac[n+4]={ };
    for(int i=n; i>0; i--)
    {
        ac[i]=max(0LL,cad[i]-cad2[i-1]);
        ac[i]=max(ac[i+1],ac[i]);
        //cout<<ac[i]<<" ";
    }
    ll act=0;
    cout<<ac[1]<<" ";
    for(int i=0; i<n; i++)
    {
        //cout<<act;
        act=max(act,cad[i]-cad2[i]);
        cout<<max(ac[i+2],act)<<" ";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -