Cod sursa(job #978606)
Utilizator | Data | 29 iulie 2013 11:28:31 | |
---|---|---|---|
Problema | Sortare prin comparare | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include <fstream>
#include <queue>
using namespace std;
ifstream f("algsort.in");
ofstream g("algsort.out");
int n, i, x;
priority_queue<int, vector<int>, greater<int> > h;
int main(){
f>>n;
for(i=1; i<=n; i++)
{
f>>x;
h.push(x);
}
f.close();
while(!h.empty())
{
g<<h.top()<<' ';
h.pop();
}
g<<"\n";
g.close();
return 0;
}