#include "locmin.h"
#include <iostream>
#include <climits>
#include <algorithm>
using namespace std;

#define MAXM 500

int v[MAXM+1];

pair<int,int> find_locmin_point(int N,int M){
  for(int i=1;i<=M;i+=2){
    if(i+2>M){
      v[i+1]=value(1,i);
    }else{
      v[i+1]=min(value(1,i),value(1,i+2));
    }
  }

  for(int i=2;i<=M;i+=2){
    if(value(1,i)<v[i]){
      return {1,i};
    }
  }

  return {};
}
