Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
566 B
0
Indexable
Never
#include <iostream>
#include <fstream>
#include <stdint.h>
#include <algorithm>
#include <string>
#include "Header.h" 
using namespace std;
int med(vector <int> a) {
	sort(a.begin(), a.end());
	return a[a.size() / 2];
}
int main() {
	int a, b;
	cin >> a >> b;
	vector <vector <int>> c(a, vector <int> (b));
	vector <int> medd;
	for (int i = 0; i < a; i++){
		for (int j = 0; j < a; j++) {
			int d;
			cin >> d;
			c[i].push_back(d);
		}
		medd.push_back(med(c[i]));
	}
	for (auto i : medd) {
		cout << i << '\n';
	}
	cout << med(medd);
}