alphacademy-cpp/hf/hf4/3.cpp

39 lines
804 B
C++
Raw Normal View History

2022-10-23 12:37:04 +00:00
#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;
}