I want to use Index and ENUM given above. You can change the given function as desired, but the function parameters should remain constant . This code work without changing the content of the main function I just try it for days. But I'cant. I'am new to coding. I hope you are help me. And why am I get so much stack like that you can write your suggestions for me.
#include<iostream>
#include<vector>
#include <map>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
enum DIR
{
DOWN = 1, RIGHT = 2
};
struct Index
{
int i, j;
Index(int _i, int _j)
{
i = _i; j = _j;
}
};
int MinimumCostPath(vector<vector<int>>& M, vector<Index>& Path)
{
}
int main() {
vector<vector<int>> M = { {0, 1, 5},
{2, 4, 2},
{1, 3, 0} };
vector<Index> Path;
vector<Index> sol = { Index(0, 0), Index(1, 0), Index(2, 0), Index(2, 1), Index(2, 2) };
int cost = MinimumCostPath(M, Path);
if (cost != 6) return 0;
if (Path.size() != sol.size()) return 0;
for (size_t i = 0; i < sol.size(); i++) {
if (sol[i].i != Path[i].i) return 0;
if (sol[i].j != Path[i].j) return 0;
} //end-for
return 10;
cout<<cost<<endl;
}