답안 #943935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
943935 2024-03-12T04:58:21 Z RGBB Vrtić (COCI18_vrtic) C++14
32 / 160
1 ms 464 KB
#include <bits/stdc++.h>
using namespace std;

const int MAX = 150;

int n;

int a[MAX], b[MAX], outp[MAX];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    sort(b, b + n);
    outp[0] = b[0];
    for(int i = 1; i < n; i++) {
        if(i % 2) outp[(i + 1) / 2] = b[i];
        else outp[n - i / 2] = b[i];
    }
    int bv = abs(outp[n - 1] - outp[0]);
    for(int i = 0; i < n - 1; i++) bv = max(bv, abs(outp[i + 1] - outp[i]));
    cout << bv << "\n";
    for(int i = 0; i < n - 1; i++) cout << outp[i] << " ";
    cout << outp[n - 1] << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 460 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 464 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -