Cod sursa(job #1517850)
| Utilizator | Data | 4 noiembrie 2015 22:04:19 | |
|---|---|---|---|
| Problema | Interclasari | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.58 kb |
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("interclasari.in", "r", stdin);
freopen("interclasari.out", "w", stdout);
priority_queue <int> q;
int n, s=0, i, k, x;
scanf("%d", &k);
while(k--)
{
scanf("%d", &n);
s=s+n;
for(i=1; i<=n; i++)
{
scanf("%d", &x);
q.push(-x);
}
}
printf("%d\n", s);
while (s)
{
printf("%d ", -q.top());
q.pop();
s--;
}
fclose(stdin);
fclose(stdout);
return 0;
}
