public Solve solve() { int cost = 0; int[][] transport = new int[task.n][]; used = new bool[task.n][]; for (int k = 0; k < task.n; k++) { transport[k] = new int[task.m]; used[k] = new bool[task.m]; } while (!task.check()) { int i, j; getCell(out i, out j); used[i][j] = true; int min = Math.Min(task.vectorN[i], task.vectorM[j]); transport[i][j] = min; cost += task.matrix[i][j] * transport[i][j]; task.vectorN[i] -= min; task.vectorM[j] -= min; } return(new Solve(transport, task.n, task.m, cost)); }
public Solve solve() { while (true) { drop(); setMin(); if (workedArea.check()) { break; } setSaldoN(); setSaldoM(); setDopVectorN(); setDopVectorM(); int renta = getRenta(); newInteration(renta); } return(new Solve(transport, task.n, task.m, cost)); }