View Code of Problem 85

#include<iostream>
#include<string>
using namespace std;
int main(void){
	int m,n;
	cin>>m>>n;
	int a[m][n];
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=0;i<m;i++){
		int y=0;
		for(int j=1;j<n;j++){
			if(a[i][y]>a[i][j])
				y=j;
		}
		int x=i;
		for(int k=0;k<m;k++)
			if(a[x][y]<a[k][y])
				x=k;
		if(x==i) cout<<x+1<<" "<<y+1;
	}
}

Double click to view unformatted code.


Back to problem 85