首页 > 代码库 > POJ 3469 Dual Core CPU
POJ 3469 Dual Core CPU
一堆任务分配到2个不同的芯片上运行,一个任务在不同芯片上运行的时间不一样,有一些任务组如果分配到不同的芯片上运行会产生额外的时间....
用最小的费用将不同对象划分到两个集合 , 最小割问题 .
建图:
用源点汇点代表两个芯片
对某个任务 , 在 A 芯片上运行时间 t1 . 则从源点连一条 到 这个任务容量为 t1 的边 . 对 B 芯片上运行时间同理
如果两个任务间有联系,着再俩个任务间连边.
原问题就转化成了, 将图分成两部分,所切割的容量最少.
最小割==最大流 isap 解决
Dual Core CPU
Description As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft Corporation, decided to update their famous product - SWODNIW. The routine consists of N modules, and each of them should run in a certain core. The costs for all the routines to execute on two cores has been estimated. Let‘s define them as Ai and Bi. Meanwhile, M pairs of modules need to do some data-exchange. If they are running on the same core, then the cost of this action can be ignored. Otherwise, some extra cost are needed. You should arrange wisely to minimize the total cost. Input There are two integers in the first line of input data, N and M (1 ≤ N ≤ 20000, 1 ≤ M ≤ 200000) . Output Output only one integer, the minimum total cost. Sample Input 3 1 1 10 2 10 10 3 2 3 1000 Sample Output 13 Source POJ Monthly--2007.11.25, Zhou Dong |
[Submit] [Go Back] [Status] [Discuss]
POJ 3469 Dual Core CPU