Pagini recente » Cod sursa (job #3134877) | Rating Beznea Mircea-Andrei (mirceabeznea) | Istoria paginii runda/5/clasament | Cod sursa (job #190224) | Cod sursa (job #757982)
Cod sursa(job #757982)
#include <fstream>
#include <queue>
using namespace std;
const int N = 500005;
int v[N], n;
priority_queue<int> Q;
ifstream in("algsort.in");
ofstream out("algsort.out");
int main()
{
int x;
in >> n;
for (int i = 1 ; i <= n ; i++)
{
in >> x;
Q.push(x);
}
for (int i = n ; i ; i--)
{
v[i] = Q.top();
Q.pop();
}
for (int i = 1 ; i <= n ; i++)
out << v[i] << " ";
out << "\n";
return 0;
}