Pagini recente » Cod sursa (job #1456837) | Cod sursa (job #2551268) | Cod sursa (job #3159927) | Cod sursa (job #70717) | Cod sursa (job #1487015)
#include <fstream>
#include <queue>
using namespace std;
ifstream f("interclasari.in");
ofstream g("interclasari.out");
struct cmp{
bool operator()(const int A,const int B) const
{
return A>B;
}
};
priority_queue <int,vector<int>,cmp> Q;
int main()
{
int k,sol=0,n,x;
f>>k;
for(int i=1;i<=k;i++)
{
f>>n;
sol+=n;
for(int j=1;j<=n;j++)
{
f>>x;
Q.push(x);
}
}
g<<sol<<"\n";
while(sol>0)
{
g<<Q.top()<<" ";
sol--;
Q.pop();
}
return 0;
}