Cod sursa(job #2722412)
| Utilizator | Data | 12 martie 2021 20:17:07 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
/**
*/
#include <fstream>
#include <queue>
#include <vector>
using namespace std;
ifstream fin("algsort.in");
ofstream fout("algsort.out");
priority_queue <int> q;
const int nmax=5e5 +5;
int n;
int main()
{
int x,v[nmax];
fin>>n;
for(int i=1;i<=n;i++)
{
fin>>x;
q.push(x);
}
int i=0;
while(!q.empty())
{
v[++i]=q.top();
q.pop();
}
for(int i=n;i>=1;i--)
{
fout<<v[i]<<" ";
}
return 0;
}
