Submission #1114618

# Submission time Handle Problem Language Result Execution time Memory
1114618 2024-11-19T09:07:07 Z AdamGS Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 336 KB
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll n; cin >> n;
    vector<ll> wolne(n + 1);
    for(int i = 0; i < n + 1; i++) {
        cin >> wolne[i];
    }
    vector<ll> ter(n);
    for(int i = 0; i < n; i++) {
        cin >> ter[i];
    }

    sort(wolne.begin(), wolne.end());
    sort(ter.begin(), ter.end());

    for(int i = 0; i < n + 1; i++) {
        ll mx = 0;
        for(int j = 0; j < i; j++) {
            mx = max(mx, wolne[j] - ter[j]);
        }
        for(int j = i; j < n; j++) {
            mx = max(mx, wolne[j + 1] - ter[j]);
        }
        cout << mx << "\n";
    }
}
# 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 -