#include <iostream>
#include <algorithm>
using namespace std;
bool qw
(int g, int b)
{
return g>b;
}
int main()
int n,l;
cin >>n;
int A[n];
l=0;
for (int r=0; r<n;r++)
cin >> A[r];
sort(A,A+n/2);
sort(A+n/2,A+n,qw);
for (int x=0; x<n;x++)
if(l<1)
cout <<A[x];
l++;
else if(l==1)
cout <<" "<<A[x];
return 0;
#include <iterator>
#include <vector>
int main() {
int n = 5;
int m = 6;
vector<vector<int>> a(n, vector<int>(m));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j)
cin >> a[i][j];
vector<double> ans(m);
for (int i = 0, q = 0; i < m; ++i, ++q) {
int sum = 0;
int cnt = 0;
for (int j = 0; j < n; ++j) {
if (a[j][i] < 0) {
sum += a[j][i];
++cnt;
if (sum)
ans[q] = sum / (double)cnt;
copy(ans.cbegin(), ans.cend(), ostream_iterator<double>(cout, " "));
#include <iostream>
#include <algorithm>
using namespace std;
bool qw
(int g, int b)
{
return g>b;
}
int main()
{
int n,l;
cin >>n;
int A[n];
l=0;
for (int r=0; r<n;r++)
{
cin >> A[r];
}
sort(A,A+n/2);
sort(A+n/2,A+n,qw);
for (int x=0; x<n;x++)
{
if(l<1)
{
cout <<A[x];
l++;
}
else if(l==1)
{
cout <<" "<<A[x];
}
}
return 0;
}
#include <iostream>
#include <iterator>
#include <vector>
using namespace std;
int main() {
int n = 5;
int m = 6;
vector<vector<int>> a(n, vector<int>(m));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j)
cin >> a[i][j];
}
vector<double> ans(m);
for (int i = 0, q = 0; i < m; ++i, ++q) {
int sum = 0;
int cnt = 0;
for (int j = 0; j < n; ++j) {
if (a[j][i] < 0) {
sum += a[j][i];
++cnt;
}
}
if (sum)
ans[q] = sum / (double)cnt;
}
copy(ans.cbegin(), ans.cend(), ostream_iterator<double>(cout, " "));
}