题意: 二分图 有k条边,我们去选择其中的几条 每选中一条那么此条边的u 和 v的度数就+1,最后使得所有点的度数都在[l, r]这个区间内 , 这就相当于 边流入1,流出1,最后使流量平衡 解析: 这是一个无源汇有上下界可行流 先添加源点和汇点 超级源超级汇  跑遍dinic板子 就好了...看了一发蔡队的代码,学到了好多新知识(逃)... #include <bits/stdc++.h> #define mem(a, b) memset(a, b, sizeof(a)) #define r…
"Oh, There is a bipartite graph.""Make it Fantastic." X wants to check whether a bipartite graph is a fantastic graph. He has two fantastic numbers, and he wants to let all the degrees to between the two boundaries. You can pick up sev…
"Oh, There is a bipartite graph.""Make it Fantastic."X wants to check whether a bipartite graph is a fantastic graph. He has two fantastic numbers, and he wants to let all the degrees to between the two boundaries. You can pick up seve…
正解: #include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN=10010;//点数的最大值 const int MAXM=400010;//边数的最大值 #define captype int struct SAP_MaxFlow{ struct EDGE{ int to,next; captype cap; }edg[MAXM]; int eid,head[MAXN];…
https://nanti.jisuanke.com/t/31447 题意 一个二分图,左边N个点,右边M个点,中间K条边,问你是否可以删掉边使得所有点的度数在[L,R]之间 分析 最大流不太会.. 贪心做法: 考虑两个集合A和B,A为L<=d[i]<=R,B为d[i]>R 枚举每个边 1.如果u和v都在B集合,直接删掉2.如果u和v都在A集合,无所谓3.如果u在B,v在A,并且v可删边即d[v]>L4.如果u在A,v在B,并且u可删边即d[u]>L 最后枚举N+M个点判断是…
关于有源上下界最大流: https://blog.csdn.net/regina8023/article/details/45815023 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n, m, k, l, r, s, t, superS, superT; ;//点数的最大值 ;//边数的最大值 const int INF = 0x3f3f3f3f; st…
题目链接: https://nanti.jisuanke.com/t/31452 AC代码(看到不好推的定理就先打表!!!!): #include<bits/stdc++.h> using namespace std; # define maxn 40000+100 int a[maxn]; int b[maxn]; int ans=0; char s[1000]; int c[maxn]; int ti=0; void f() { memset(c,0,sizeof(c)); memset(…
求第k短路 模板题 套模板即可 #include <iostream> #include <cstring> #include <cstdio> #include <cmath> #include <queue> using namespace std; ; ; struct State{ int f; // f=g+dis dis表示当前点到终点的最短路径,即之前的预处理 int g; //g表示到当前点的路径长度 int u; bool op…
原题链接:https://nanti.jisuanke.com/t/31450 附上队友代码:(感谢队友带飞) #include <bits/stdc++.h> using namespace std; #define ll long long #define FOR(i,a,b) for(int i=(a);i<=(b);++i) #define DOR(i,a,b) for(int i=(a);i>=(b);--i) const int maxN=2e5+5,inf=0x3f3…
Made In Heaven One day in the jail, F·F invites Jolyne Kujo (JOJO in brief) to play tennis with her. However, Pucci the father somehow knows it and wants to stop her. There are N spots in the jail and MM roads connecting some of the spots. JOJO finds…