39 lines
804 B
C++
39 lines
804 B
C++
#include <bits/stdc++.h>
|
|
#include <iostream>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n, m, temp;
|
|
//int min = 51;
|
|
//int max = -51;
|
|
int out = 1;
|
|
cin >> n >> m;
|
|
|
|
vector<vector <int>> maxmin(m, vector<int> (3)); // min, max /n
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
int min = 51;
|
|
int max = -51;
|
|
for (int j = 0; j < m; j++) {
|
|
cin >> temp;
|
|
if (temp > max) {
|
|
max = temp;
|
|
}
|
|
if (temp < min) {
|
|
min = temp;
|
|
}
|
|
}
|
|
cout<<min<<' '<<max<<endl;
|
|
maxmin[i][0] = min;
|
|
maxmin[i][1] = max;
|
|
|
|
}
|
|
for (int i = 0; i < n; i++) {
|
|
for (int j = 0; j < m; j++) {
|
|
cout<<maxmin[i][j]<<' ';
|
|
}
|
|
cout<<endl;
|
|
}
|
|
cout<<out;
|
|
|
|
} |