Pagini recente » Diferente pentru problema/tir intre reviziile 3 si 21 | Cod sursa (job #1258383) | Diferente pentru problema/pufu intre reviziile 2 si 1 | Cod sursa (job #1578127) | Cod sursa (job #562493)
Cod sursa(job #562493)
#include<fstream>
#include<algorithm>
#include<list>
#include<vector>
using namespace std;
bool myfunction (int i,int j) { return (i>j); }
int n,x;
vector<int> V;
int main()
{
ifstream in("quicksort.in");
ofstream out("quicksort.out");
in>>n;
for(int i=1;i<=n;i++)
{
in>>x;
V.push_back(x);
}
for(int i=1;i<=n;i++)
{
nth_element(V.begin(),V.end(),V.end(),myfunction);
out<<V[V.size()-1]<<" ";
V.pop_back();
}
return 0;
}