Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
551 B
0
Indexable
Never
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    int n, m, x=0, x1=0, input;
    cin >> n >> m; 
	vector < vector <int> > a(n, vector <int>(m));
	vector <int> b(n);
	for (int i = 0, r = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> a[i][j];
		}
		sort(a[i].begin(), a[i].end());

	}
	cout << endl;
	for (int i = 0; i < n; i++)
	{
		cout << a[i][m / 2] << endl;
		b[i] = a[i][m / 2];
	}
	sort(b.begin(), b.end());
	cout << endl << b[n / 2];
}