Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
472 B
0
Indexable
Never
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	vector<int> arr;
	vector<int> marr;
	int n;
	int m;
	int i,j;
	int a;
	cin >> n;
	cin >> m;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			cin >> a;
			arr.push_back(a);
		}
		sort(arr.begin(), arr.end());
		marr.push_back(arr[(arr.size() - 1) / 2]);
		arr.clear();
	}
	sort(marr.begin(), marr.end());
	cout << marr[(marr.size() - 1) / 2];
}