Cod sursa(job #2675351)

Utilizator IoanaNadIoana Nadia Puiu IoanaNad Data 21 noiembrie 2020 14:24:28
Problema Interclasari Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;


int main() {
	ifstream fin("interclasari.in");
	ofstream fout("interclasari.out");
	vector<int> photos;
	int k;
	fin >> k;
	for (int i = 0; i < k; ++i) {
		int Ni, photoMoment;
		fin >> Ni;
		for (int j = 0; j < Ni; ++j) {
			fin >> photoMoment;
			photos.push_back(photoMoment);
		}
	}
	sort(photos.begin(), photos.end());
	int length = photos.size();
	fout << length << "\n";
	for (int i = 0; i < length; ++i)
		fout << photos[i] << " ";
	return 0;
}