#include "locmin.h"
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

std::pair <int, int> find_locmin_point(int N, int M) {
	int n = N, m = M;
	vector<vector<int>> a(n + 4);
	long long mn = -1;
	pair<int, int> mnind;
	for (int i = 1; i <= n; ++i) {
		a[i].resize(m + 4);
		for (int j = 1; j <= n; ++j) {
			a[i][j] = value(i, j);
			if (a[i][j] <= mn || mn==-1) {
				mn = a[i][j];
				mnind = { i,j };
			}
		}
	}
	return mnind;
}
