Cod sursa(job #414327)
| Utilizator | Data | 9 martie 2010 22:29:38 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <stdio.h>
#include <queue>
#define IN "algsort.in"
#define OUT "algsort.out"
#define size
using namespace std;
struct cmp
{
bool operator()(const int &a,const int&b)const
{
return a>b;
}
};
priority_queue <int,vector<int>,cmp> Q;
int main ()
{
int n,x;
freopen (IN ,"r",stdin);
freopen (OUT ,"w",stdout);
scanf ("%d",&n);
for (int i=0;i<n;i++)
{
scanf ("%d ",&x);
Q.push(x);
}
while (!Q.empty())
{
printf("%d ",Q.top());
Q.pop();
}
printf("\n");
return 0;
}
