Cod sursa(job #3300260)

Utilizator lucian243Condrea Andrei Lucian lucian243 Data 14 iunie 2025 09:17:34
Problema Interclasari Scor 30
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.57 kb
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;
ifstream f("interclasari.in");
ofstream g("interclasari.out");
priority_queue<int,vector<int>,greater<int>> pq;
map<int,bool> mp;
int n,k,x;
int main() {
	f>>k;
    for(int i=1;i<=k;i++)
    {
        f>>n;
        for(int j=1;j<=n;j++)
        {
            f>>x;
            if(!mp.count(x))
            {
                mp[x]=true;
                pq.push(x);
            }
        }
    }
    g<<mp.size()<<'\n';
    while(!pq.empty())
    {
        g<<pq.top()<<' ';
        pq.pop();
    }
}