Untitled

 avatar
unknown
plain_text
2 years ago
570 B
6
Indexable
#include <string>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int m, n, h;
	cin >> n >> m;
	vector<int> jk;
	vector<int> fs;
	for (int i = 0; i < n; i++)
	{
		for (int i = 0; i < m; i++)
		{
			cin >> h;
			fs.push_back(h);
		}
		sort(fs.begin(), fs.end());
		jk.push_back(fs[(fs.size()) / 2]);
		while(fs.size())
			fs.pop_back();
	}
	for (int i = 0; i < jk.size(); i++)
	{
		cout << jk[i]<< " ";
	}
	sort(jk.begin(), jk.end());
	cout << endl << jk[(jk.size()) / 2];
}
Editor is loading...