class

AtCoder::MinCostFlow

Inherits Reference / Object

Implements atcoder::mcf_graph.

flow = AtCoder::MinCostFlow.new(5)
flow.add_edge(0, 1, 30, 3)
flow.add_edge(0, 2, 60, 9)
flow.add_edge(1, 2, 40, 5)
flow.add_edge(1, 3, 50, 7)
flow.add_edge(2, 3, 20, 8)
flow.add_edge(2, 4, 50, 6)
flow.add_edge(3, 4, 60, 7)
flow.flow(0, 4, 70) # => {70, 1080}

Constructors

new(size : Int64)

Implements atcoder::mcf_graph g(n).

Source

Instance methods

add_edge(from, to, capacity, cost)

Implements atcoder::mcf_graph.add_edge(from, to, capacity, cost).

Source
flow(start, target, flow_limit : Int | Nil = nil)

Implements atcoder::mcf_graph.flow(start, target, flow_limit).

Source
size(*args, **options)
Source
size(*args, **options, &)
Source
slope(start, target, flow_limit : Int | Nil = nil)

Implements atcoder::mcf_graph.slope(start, target, flow_limit). ameba:disable Metrics/CyclomaticComplexity

Source