Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
463 B
0
Indexable
Never
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool comp(int a, int b) {
	if (a > b) {
		return 1;
	}
	else return 0;
}
int main() {
	int n, m, a; cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		vector<int> V;
		for (int i = 0; i < m; i++)
		{
			cin >> a;
			V.push_back(a);
		}
		sort(V.begin(), V.end(), comp);
		cout << "Max: " << V.front()<< " " << "Min: " << V.back() << endl;
	}
}