View Code of Problem 85

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
	int m, n;
	scanf("%d%d", &m, &n);
	int a[m][n];
	for(int i = 0;i < m;i++){
		for(int j = 0;j < n;j++){
			scanf("%d", &a[i][j]);
		}
	}
	int x, y;
	for(int i = 0;i < m;i++){
		y = 0;
		for(int j = 0;j < n;j++){
			if(a[i][j]<a[i][y]){
				y = j;
			}
		}
		x = i;
		for(int k = 0;k < m;k++){
			if(a[k][y]>a[x][y]){
				x = k;
			}
		}
		if(x==i) printf("%d %d\n", x+1, y+1);
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 85