网络流24题 太空飞行计划问题
题目传送门 这道题不是好久之前做的了 填一下网络流24题的坑 本质上是个最大权闭合图问题的模板 (话说这么多问题,我怎么记得住) 在源点 \(S\) 和每个实验之间连一条边权为实验利益的边 在每个实验和它需要的仪器之间连一条边权为 \(+\infty\) 的边 在仪器和汇点 \(t\) 之间连一条边权为仪器花费的边 然后跑最小割就好了 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #define LL long long #define inf 0x7fffffff using namespace std; LL read() { LL k = 0, f = 1; char c = getchar(); while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar(); } while(c >= '0' && c <= '9') k = k * 10 + c - 48, c = getchar(); return k * f; } struct zzz { int t, nex, len; }e[100010 << 1]; int head[1010], tot = 1; void