題解/算法 {376. 机器任务}

題解/算法 {376. 机器任务}

@LINK: https://www.acwing.com/problem/content/378/;

比如一个任务是(ai, bj), 你把ai,bi当作是一个二分图 ai是左侧点, 然后把一个任务 当作是ai-bj这条边, 那么问题就转换为: 选择最少的点 覆盖所有的边 即最小点覆盖;

Solution

Let the mode of two machines are [ 0 , . . . , A ) , [ 0 , . . . , B ) [0,...,A), [0,...,B) [0,...,A),[0,...,B), if we remove all tasks ( a , b ) (a,b) (a,b) whose a / b = 0 a/b = 0 a/b=0, then the problems becomes that choose as least as possible modes from [ 1 , . . . , A ) , [ 1 , . . . , B ) [1,...,A), [1, ..., B) [1,...,A),[1,...,B) such that they covers all tasks.

--

Let’s see a wrong Greed-Method, there are A − 1 + B − 1 A-1+B-1 A1+B1 modes, each time we choose a mode which covers the maximal count of tasks;

--

In fact, this is template-problem, if we transform a task a ∈ [ 1 , A ) , b ∈ [ 1 , B ) a \in [1,A) ,b \in [1, B) a[1,A),b[1,B) to a Undirected-Edge ( a − b 1 ) (a-b1) (ab1) where b 1 = b + A b1 = b +A b1=b+A (i.e., all machine-modes-id of two machines are distinct), now we get a undirected-graph G G G; then our goal to choose at least points to cover all edges; that is find the Minimum Point Coverage of G G G;
Moreover, cuz G G G is also a Bipartite (making all points which < A < A <A be the L L L-Set, and others be R R R-Set), so it corresponds to the Minimum-Point-Coverage in a Bipartite;

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值