此题可以拆边简单做
查看原帖
此题可以拆边简单做
723238
wukaichen888楼主2024/7/15 23:46

不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解 不是讨论区题解

考虑拆边,变为 tottot 与 tot+Mtot+M,frfr 连向 tot+Mtot+M,tottot 连向 toto。

tot+Mtot+M 流量为 11 连向 TT,SS 流量为 11 连向 tottot,以最大流约束遍历。

tot+Mtot+M 流量 infinf 连向 tottot,表示重开经过该边。

	add2(s,1,inf,0);
	for(int i=1,x,y,z;i<=n;i++){
		scanf("%d",&x);
		for(int j=1;j<=x;j++){
			scanf("%d%d",&y,&z);
			++tot;
			add2(i,n+5000+tot,inf,z);
			add2(n+5000+tot,t,1,0);
			add2(n+5000+tot,n+tot,inf,0);
			add2(s,n+tot,1,0);
			add2(n+tot,y,inf,0);
		}
	}
2024/7/15 23:46
加载中...