Submission #1116588

# Submission time Handle Problem Language Result Execution time Memory
1116588 2024-11-21T21:07:56 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>

using namespace std;

int main(){

    int n;
    cin>>n;

    deque<int> a,b,aux;

    for(int i=0;i<n+1;i++){
        int x;
        cin>>x;
        aux.push_back(x);
    }
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        a.push_back(x);
    }

    stable_sort(a.begin(),a.end()); 

    int ans=0;

    for(int i=0;i<n;i++){
        swap(aux[i],aux[n]);
        for(int j=0;j<n;j++){
            b.push_back(aux[j]);
        }
        stable_sort(b.begin(),b.end());
        for(int j=0;j<n;j++){
            ans=max(ans,abs(b[j]-a[j]));
        }
        swap(aux[i],aux[n]); 
        b.clear();
        cout<<ans<<' ';
        ans=0;
    }

    aux.pop_back();
    stable_sort(aux.begin(),aux.end());
    ans=0;
    for(int i=0;i<n;i++){
        ans=max(ans,abs(b[i]-a[i]));
    }

    cout<<ans<<'\n';



    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -