Network flow modeling Summary

• Introduction

Recently the network flow modeling to see a summary of Edelweiss

Network modeling techniques to study flow

After all, the network flow problem the difficulty lies in how to build the chart, most of the rest is a routine

So also write down their thoughts and ideas

(Although the idea has been drawing big brother)

• Maximum flow

  •POJ 1149  PIGS

[Title] effect

There are M pigsty, each pigpen pigs initially several pig [i]. All the outset pigsty are closed. Turn to the N number of customers, each customer will respectively open a specified number sty, buy from a number of pigs. Each customer has an upper limit, respectively, he was able to buy a number. Each customer had gone, he opened the pig sty of those can be arbitrarily transposed to other open pigsty, pigpen then all closed again. Asked a total maximum number of pigs to sell. (1 <= N <= 100, 1 <= M <= 1000)

[Thinking]

S provided a source point, a sink point t

Each to a customer $ m + i $ (m + 1 customers from start number), if he has the key to the pigsty has not been opened, and that even a traffic source and his pig sty for this purpose the number of $ ( s, i, pig [i]) $ edge

If he has $ index $ key sty been opened, and that even before a man and he opened a flow of INF edge $ (vis [index], i, INF) $

Each customer is connected with a sink for this customer purchasing power flow edge $ (m + i, t, buy) $

In fact, the mix can be exchanged in a pigsty together, st pig flow and exchange of correspondence up

[Code]

POJ 1149 Pigs

 

•POJ 3281  Dining

[Title] effect

There are kinds of food F and D types of drinks, each food or drink can only be enjoyed for a cow, and just enjoy each head of cattle a food and a drink. There are N cows, each cow has its own list of favorite types of food and beverages species list, ask to make up to a few head of cattle while enjoying their favorite food and beverages. (1 <= F <= 100, 1 <= D <= 100, 1 <= N <= 100)

[Thinking]

 

 

 

 

Guess you like

Origin www.cnblogs.com/MMMinoz/p/11615033.html