Submission #777382

# Submission time Handle Problem Language Result Execution time Memory
777382 2023-07-09T07:35:16 Z 1bin Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
0 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

#define all(v) v.begin(), v.end()
typedef long long ll;
const int NMAX = 2e5 + 5;
ll n, a[NMAX], b[NMAX];
multiset<ll> s;

int main(void){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n;
    for(int i = 0; i <= n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    sort(a, a + n + 1);
    sort(b, b + n);
    for(int i = 0; i < n; i++) s.emplace(a[i + 1] - b[i]);
    cout << max(*s.rbegin(), 0LL) << ' ';
    for(int i = 0; i < n; i++){
        s.erase(s.find(a[i + 1] - b[i]));
        s.emplace(a[i] - b[i]);
        cout << max(*s.rbegin(), 0LL) << ' ';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -