随笔分类 - 图论__网络流
摘要:首先,明显的网络流。那么如何建边,对于每个二次函数在[1,m]里挑n个函数值最小的点, 这样子一共n^2个点,注意还要去重。这n^2个点其实就能使得n个二次函数(a, b, c)完全匹配。 那么流量全部设为1,费用是对应的函数值。超级源点和终点费用为0;但是,跑n次费用流时间不允许,但是你仔细想每次
阅读全文
摘要:#pragma GCC optimize(2) #include<bits/stdc++.h> //#define int long long using namespace std; const int inf=0x3f3f3f3f; const int N=5010,M=2e5+10; int
阅读全文
摘要:#include<bits/stdc++.h> #define ll long long #define PB push_back #define endl '\n' #define INF 0x3f3f3f3f #define LINF 0x3f3f3f3f3f3f3f3f #define ull
阅读全文
摘要:#include<bits/stdc++.h> #define ll long long #define PB push_back #define endl '\n' #define INF 0x3f3f3f3f #define LINF 0x3f3f3f3f3f3f3f3f #define ull
阅读全文
摘要:题目链接:https://ac.nowcoder.com/acm/contest/5666/H 题意:给你一个n个点m条边的图,q次询问每次给出u和v,每条边的容量都为u/v, 初始流量为1,询问满流时候的最小费用。 首先将每条边的容量设为1跑一遍费用流 。那么对于某次询问容量变为u/v,只要将起始
阅读全文

浙公网安备 33010602011771号