Submission #239058

# Submission time Handle Problem Language Result Execution time Memory
239058 2020-06-14T09:27:44 Z NONAME Vrtić (COCI18_vrtic) C++14
32 / 160
5 ms 384 KB
#include <iostream>
#include <vector>
#include <queue>
#include <fstream>
#include <algorithm>
using namespace std;

using ll = long long;

const int N = 2e5 + 10;
const ll oo = 1e18;

int n, a[N], best = 1e9;

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

    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
    }
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    sort(a, a + n);

    vector <int> res(n);

    res[0] = a[0];
    for (int i = 1; i < n; ++i)
        if (i & 1) res[(i + 1) / 2] = a[i];
            else res[n - (i / 2)] = a[i];

    best = abs(res[0] - res[n - 1]);
    for (int i = 1; i < n; ++i)
        best = max(best, abs(res[i] - res[i - 1]));

    cout << best << "\n";
    for (int i = 0; i < n; ++i)
        cout << res[i] << ' ';
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB the dissatisfaction value doesn't match with your answer
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB the dissatisfaction value doesn't match with your answer
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB the dissatisfaction value doesn't match with your answer
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -