POJ 1149 - PIGS
Problem : M pig houses, each houses has p[i] pigs. N customers come in order, each customer open some pig houses and buy q[i] pigs, after that, pig can change house in opened houses, then pig houses close and wait the next customer come. Find a exchange way, to make the sold pigs maximum.
Solution : Each customer is a vertice. If a customer is the first person to open some pig house, connect an edge from source to that customer, with capacity of p[pig]. Otherwise, connect an edge from previous customer who can open this pig house to current customer, with inf capacity. Each customer connect an edge from it to sink, with capacity q[customer].
Proof : A pig's any kind of exchange and sale (after exchange) can be represent by a unit flow, vice versa.