Pagini recente » Cod sursa (job #2431939) | Cod sursa (job #2627862) | Cod sursa (job #3168581) | Cod sursa (job #2613218) | Cod sursa (job #774241)
Cod sursa(job #774241)
#include <iostream>
#include <fstream>
#include <queue>
using namespace std;
ifstream in ("algsort.in");
ofstream out ("algsort.out");
struct comp
{
inline bool operator () (const int &a, const int &b){
return a > b;
}
};
priority_queue < int, vector <int>, comp > heap;
int main ()
{
int N, x;
in >> N;
while (N--){
in >> x;
heap.push (x);
}
while (!heap.empty ()){
out << heap.top () << " ";
heap.pop ();
}
return 0;
}