Pagini recente » Istoria paginii runda/sim_oji_10/clasament | Cod sursa (job #675484) | Cod sursa (job #1812333) | Cod sursa (job #3209674) | 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;
}