Submission #342685

# Submission time Handle Problem Language Result Execution time Memory
342685 2021-01-02T16:10:50 Z blue Just Long Neckties (JOI20_ho_t1) C++11
0 / 100
1 ms 364 KB
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;

int main()
{
    int N;
    cin >> N;

    int A[N+1];
    for(int i = 0; i < N+1; i++) cin >> A[i];
    sort(A, A+N+1);

    int B[N];
    for(int i = 0; i < N; i++) cin >> B[i];
    sort(B, B+N);

    multiset<int> strange;
    for(int i = 0; i < N; i++) strange.insert(max(A[i] - B[i], 0));

    int res[N+1];

    res[N] = *strange.rbegin();

    for(int i = N-1; i >= 0; i--)
    {
        strange.erase(strange.find(max(A[i] - B[i], 0)));
        strange.insert(max(A[i+1] - B[i], 0));

        res[i] = *strange.rbegin();
    }
    for(int i = 0; i < N+1; i++) cout << res[i] << ' ';
    cout << '\n';
}
# 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 -