Submission #669218

# Submission time Handle Problem Language Result Execution time Memory
669218 2022-12-06T03:45:06 Z GrandTiger1729 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
0 ms 212 KB
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int n; cin >> n;
    int a[n + 2]{}, b[n + 1]{};
    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);
    int pref[n + 1]{};
    for (int i = 1; i <= n; i++){
        pref[i] = max(pref[i - 1], a[i] - b[i]);
    }
    int suff[n + 3]{};
    for (int i = n + 1; i > 1; i--){
        suff[i] = max(suff[i + 1], a[i] - b[i - 1]);
    }
    for (int i = 1; i <= n + 1; i++){
        cout << max(pref[i - 1], suff[i + 1]) << " \n"[i == n + 1];
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -