Pagini recente » Cod sursa (job #833157) | Cod sursa (job #1176035) | Cod sursa (job #2135132) | Atasamentele paginii Profil andreeageniu | Cod sursa (job #2307716)
#include <fstream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
ifstream fin("algsort.in");
ofstream fout("algsort.out");
priority_queue<int,vector<int>, greater<int>> pq;
int n;
int main()
{
int x;
fin >> n;
for(int i =1; i<=n ;++i)
{
fin >> x;
pq.push(x);
}
while(!pq.empty())
{
fout << pq.top() << " ";
pq.pop();
}
return 0;
}