noobinho's blog

By noobinho, history, 6 years ago, In English

I'm trying to solve this problem: http://acm.timus.ru/problem.aspx?space=1&num=1421. I created a graph in which the source vertex is 0 and the sink vertex is 2n + 1. Vertices from 1 to n are the banks and vertices from n+1 to 2n are the enterprises. After the necessary connections have been made, I ran the O(V³) algorithm to find the maxflow of the graph and construct the demanded matrix A. I stored the sum of the lines of the matrix in the array r and the sum of the columns in the array col. If some of those sums are different from some of the elements in the arrays sr or sc or if some element of the matrix A is negative it prints "NO". It gives WA#19. Code: https://ideone.com/i9l3zW. Someone could help me, please?

  • Vote: I like it
  • -6
  • Vote: I do not like it