# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
943935 |
2024-03-12T04:58:21 Z |
RGBB |
Vrtić (COCI18_vrtic) |
C++14 |
|
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";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
the dissatisfaction value doesn't match with your answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
the dissatisfaction value doesn't match with your answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
460 KB |
the dissatisfaction value doesn't match with your answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
464 KB |
the dissatisfaction value doesn't match with your answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
the dissatisfaction value doesn't match with your answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
the dissatisfaction value doesn't match with your answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
the dissatisfaction value doesn't match with your answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
the dissatisfaction value doesn't match with your answer |
2 |
Halted |
0 ms |
0 KB |
- |