Блог пользователя _kryptonyte_

Автор _kryptonyte_, 10 лет назад, По-английски

Problem Link

My approach for solving this problem is to form a new source from given multiple sources based on the capacity of the sources. And also for the given multiple sink, form a new sink whose edge's weight is the capacity of the given (multiple) sinks. My default source and sink is 0 and 250.

In case of a node which is not source or sink, I connect a new node with that given node( adding 120 ) having a edge weights the capacity of the given node.

Then I run Flow.

My code gives Runtime error. I would be very happy with some help.

UPD:ACed it. Got some problem in implementation.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
10 лет назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

Although i am fairly new to max flow , i am not sure your created graph can handle the condition when from one regulator to another regulator between them have a link that is more than the capacity of the regulators.

Take a look at this topcoder_tutorial specially go through the 3rd para .)