You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

23 lines
508 B
C++

#include <vector>
#include <iostream>
#include <algorithm>
using std::cout, std::endl, std::vector, std::cin;
int main() {
size_t n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; ++i)
cin >> v[i];
vector<int>::iterator max = std::max_element(v.begin(), v.end());
std::sort(v.begin(), max);
std::sort(max, v.end());
std::reverse(max, v.end());
for (int i = 0; i < v.size(); ++i)
cout << v[i] << (i == v.size() - 1 ? "": " ");
cout << endl;
}