Pagini recente » Borderou de evaluare (job #1532968) | Cod sursa (job #2653748) | Cod sursa (job #1641313) | Cod sursa (job #3261980) | Cod sursa (job #2038905)
#include <bits/stdc++.h>
using namespace std;
priority_queue <int> q;
int n;
int main()
{
ifstream fin("interclasari.in");
ofstream fout("interclasari.out");
int w, k, x;
int cnt = 0;
fin >> w;
while(w)
{
w--;
fin >> k;
cnt += k;
for(int i = 1; i <= k; i++)
{
fin >> x;
q.push(-x);
}
}
fout << cnt << "\n";
while(!q.empty())
{
fout << -q.top() << " ";
q.pop();
}
return 0;
}