题意:给定一个分层图,即只能够在相邻层次之间流动,给定了各个顶点的层次.要求输出一个阻塞流. 分析:该题直接Dinic求最大流TLE了,网上说采用Isap也TLE,而最大流中的最高标号预流推进(HLPP)能够直接秒掉这一题.当然还有一种挽救的方式就是首先进行一次贪心预流,然后进行dinic.也是第一次听说还有贪心预流这回事,所以找了一份代码特地学习了一番.具体步骤如下: 1.首先将所有节点按照层次进行排序,对每个节点有in[i]和out[i]两个属性,前者表示能够流入到该节点的流量,后者表示能够…