_kryptonyte_'s blog

By _kryptonyte_, 9 years ago, In English

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.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
9 years ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

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 .)

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I have ACed it ..... btw thanks for reply ... I forget to update the blog.