top of page
biotheiwimbigbrewi

The Forbidden Arts Update V1 0 2-PLAZA



import ast# goal is to get maximum collected money among paths of# minimal length connecting [0,0] to [n,n] (moving# diagonally is forbidden).# The paths as above are obtained starting from [0,0]# and at every step moving only either on the right (i.e. from A[i,j] to A[i,j+1])# or downwards (i.e. from A[i,j] to A[i+1,j])def transform(n, st) : matr = ast.literal_eval(a) if len(matr) != len(matr[0]) or len(matr) != n : print('error') return [] else : return matrdef get_path(mat) : increments = [[0,1], [1,0]] current_nodes = [[0,0]] current_values = [mat[0][0]] money_on_paths = [] while len(current_nodes) > 0 : updated_nodes = [] updated_values = [] for l in range(0,len(current_nodes)) : if ((len(mat) -1)-current_nodes[l][0]) + (len(mat[0])-1 -current_nodes[l][1]) > 0 : for delta in increments : up = [current_nodes[l][i] + delta[i] for i in range(0, len(delta))] if up[0]




The Forbidden Arts Update V1 0 2-PLAZA



import ast# goal is to get maximum collected money among paths of# minimal length connecting [0,0] to [n,n] (moving# diagonally is forbidden).# The paths as above are obtained starting from [0,0]# and at every step moving only either on the right (i.e. from A[i,j] to A[i,j+1])# or downwards (i.e. from A[i,j] to A[i+1,j])def transform(n, st) : if len(st) == 0 or n == 0: return [] else : try : matrix = ast.literal_eval(st) except ValueError : print('Oops, something got wrong!') if len(matrix) == len(matrix[0]) and len(matrix) == n : return matrix else : return []def get_path(mat) : increments = [[0,1], [1,0]] current_nodes = [[0,0]] current_values = [mat[0][0]] money_on_paths = [] while len(current_nodes) > 0 : updated_nodes = [] updated_values = [] for l in range(0,len(current_nodes)) : if ((len(mat) -1)-current_nodes[l][0]) + (len(mat[0])-1 -current_nodes[l][1]) > 0 : for delta in increments : up = [current_nodes[l][i] + delta[i] for i in range(0, len(delta))] if up[0] 0 : return get_path(m)#testa = '[[1,2,3], [3,4,5], [1,1,3]]'print(f(3,a)) 2ff7e9595c


0 views0 comments

Recent Posts

See All

music lab mod apk

Music Lab Mod APK: uma maneira gratuita e divertida de fazer música Você adora fazer música, mas não tem tempo, dinheiro ou habilidades...

Comentários


bottom of page