Python网络流

题目:1 Load balanceYou have some different computers and jobs. For each job, it can only bedone on one of two specified computers. The load of a computer is thenumber of jobs which have been done on the computer. Give the numberof jobs and two computer ID for each job. You task is to minimize the maxload.(hint: binary search)

用Python实现,problem1.data

#There are multiple data sets.
#For each data set, the first line has two number N and M, which means the number of jobs and the number of computers.
#Next N line, each line for a job, has two number which means the two computers. 
4 2
1 2
1 2
1 2
1 2

7 49
31 49
42 21
31 37
2 44
28 10
43 7
8 48

27 29
24 8
24 6
23 29
1 11
26 26
2 3
21 6
21 10
18 9
29 4
8 14
4 21
5 20
12 29
22 11
14 28
19 15
21 15
17 12
21 16
25 22
4 22
28 14
5 20
17 5
11 18
10 23

35 13
2 6
6 12
6 9
12 1
4 13
3 2
6 8
4 11
11 12
5 10
4 1
2 13
13 9
11 5
3 9
6 5
6 6
5 3
12 8
2 9
6 8
11 2
12 5
4 6
4 2
10 10
7 10
2 6
9 12
5 5
13 7
11 10
10 12
11 1
7 2

16 90
51 50
36 17
63 29
16 40
85 84
80 51
56 7
64 57
84 81
19 65
61 75
17 35
27 25
44 19
65 71
81 10

23 47
7 1
26 38
4 18
47 20
43 25
34 22
11 17
35 35
35 21
39 45
17 15
31 15
39 27
27 5
12 47
27 12
30 23
19 7
34 14
47 35
5 38
28 23
8 3

74 31
29 12
27 25
12 28
29 13
18 29
23 13
30 25
16 31
17 20
14 14
27 13
25 18
10 7
21 7
17 19
30 14
21 29
8 28
3 5
11 22
20 5
28 6
4 5
23 10
16 9
11 19
30 17
15 10
13 21
26 3
16 19
2 3
27 19
16 25
25 30
19 19
2 23
12 26
20 16
4 14
10 2
17 6
19 20
10 24
19 12
5 18
13 2
10 26
23 7
14 21
13 3
24 13
8 3
3 11
12 12
12 11
31 21
20 15
9 18
18 1
10 5
2 26
16 19
19 3
26 24
11 30
9 23
15 20
16 12
6 10
17 27
21 31
25 28
13 26

6 30
15 13
4 14
28 11
1 22
11 14
21 11

33 58
50 45
21 23
23 32
35 51
4 53
52 48
43 58
46 53
3 52
25 40
46 17
37 18
5 50
1 55
25 3
25 22
35 43
43 40
17 26
30 50
16 11
1 47
26 40
45 22
9 34
45 14
19 47
19 36
18 38
5 37
33 30
22 24
55 43

3 52
32 46
35 17
20 40

   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值