Răspuns:
#include <iostream>
using namespace std;
int main()
{
int m, n, i, j, max=0, cnt=0, num, maxline;
cin >> m >> n;
for (i=1; i<=m; ++i)
{
maxline=0;
for (j=1; j<=n; ++j)
{
cin >> num;
if (num>maxline) { maxline=num; }
}
if (maxline>max) { max=maxline; cnt=1; }
else if (maxline==max) ++cnt;
}
cout << max << " " << cnt;
return 0;
}
Explicație: