[24 questions about network stream] ---- problem solving (partial, continuous update...), ---- Problem Solving

Source: Internet
Author: User

[24 questions about network stream] ---- problem solving (partial, continuous update...), ---- Problem Solving
Combined with pilots

With PILOT: http://cogs.yeefan.us/cogs/problem/problem.php? Pid = 14
Problem: create a virtual source sink and
Code: http://cogs.yeefan.us/cogs/submit/code.php? Id = 148410

Numerical Trapezoid

Digit trapezoid: http://cogs.yeefan.us/cogs/problem/problem.php? Pid = 1, 738
Question:
Rule (1)
Abstract each position in the trapezoid into two points (I. a) and (I. B), and create an additional S sink T.
1. For each vertex I from (I. a) to (I. B), the capacity of a connection is 1, and the cost is the directed edge of the vertex I weight.
2. From S to the top layer of the trapezoid, each (I. a) connects to a directed edge with a capacity of 1 and a cost of 0.
3. From the bottom layer of the trapezoid, each (I. B) connects to T with a directed edge with a capacity of 1 and a cost of 0.
4. For each vertex I and the following two vertex j, a directed edge is connected from (I. B) to (j. a) with a capacity of 1 and a cost of 0.
Find the maximum flow of the maximum fee. The flow value is the result.
Rules (2)
Consider each position in the trapezoid as a vertex I, and create an additional S sink T.
1. From S to the top layer of the trapezoid, each I connects a directed edge with a capacity of 1 and a cost of 0.
2. From the bottom layer of the trapezoid, each I-to-T connects a directed edge with an infinite capacity and a cost of 0.
3. For each vertex I and the following two vertex j, the capacity of a link from I to j is 1, and the cost is the directed edge of the vertex I weight.
Find the maximum flow of the maximum fee. The flow value is the result.
Rules (3)
Consider each position in the trapezoid as a vertex I, and create an additional S sink T.
1. From S to the top layer of the trapezoid, each I connects a directed edge with a capacity of 1 and a cost of 0.
2. From the bottom layer of the trapezoid, each I-to-T connects a directed edge with an infinite capacity and a cost of 0.
3. For each vertex I and the following two vertex j, the capacity of a link from I to j is infinite, and the cost is the directed edge of the vertex I weight value.
Find the maximum flow of the maximum fee. The flow value is the result.
In fact, both the second and third are well-handled, that is, the first is a little troublesome. For this question, we have established n rows which are relatively easy to write.

Code: http://cogs.yeefan.us/cogs/submit/code.php? Id = 157717

Load Balancing

Load Balancing: http://cogs.yeefan.us/cogs/problem/problem.php? Pid = 1, 741
Question:
First, obtain the average inventory quantity of all warehouses, and set the surplus volume of the I-th warehouse to A [I], A [I] = the original inventory volume of the I-th warehouse-average inventory volume. Create a bipartite graph and abstract each warehouse into two nodes Xi and Yi. Add additional source s t.
1. If A [I]> 0, A directed edge with A capacity of A [I] From S to Xi is charged.
2. If A [I] <0, A directed edge with A capacity of-A [I] is connected from Yi to T, and the cost is 0.
3. Each Xi is directed to two adjacent vertex j. A directed edge with a capacity of 1 is connected from Xi to Xj, and a directed edge with a capacity of 1 is connected from Xi to Yj, the cost is 1 directed edge.
The minimum fee is the maximum flow, and the minimum charge flow value is the minimum amount of transportation.

Code: http://cogs.yeefan.us/cogs/submit/code.php? Id = 157626

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.