Submission #239054

# Submission time Handle Problem Language Result Execution time Memory
239054 2020-06-14T09:23:24 Z NONAME Vrtić (COCI18_vrtic) C++17
0 / 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] = a[(i + 1) / 2];
            else res[i] = a[n - 1 - (i - 1) / 2];

    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 Incorrect 5 ms 384 KB jury has better answer
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB jury has better answer
# 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 4 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
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB jury has better 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB jury has better answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB jury has better 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 -