摘要:设定源点st,汇点ed将任务和每天当作两部分点建图源点连向每个任务,流量为该任务所需时间每个任务连向他可以可以做的每一天,流量为1每天连向汇点,流量为m,表示一天最多做m个任务==跑一遍最大流,如果最大流==所有任务需要天数之和即Yes,否则不能完成任务熟悉各种模型! 1 #pragma comm...
阅读全文
摘要:枚举时间来对于拆的点分层,每增加一个时间,就将所有1s能到达他的上个时间分层点->这个点的该时间分层点连一个边。源点只向第1s的‘X’连边,所有'@'直接终点在任何时间都向汇点连边。假设需要时间为ans,拆出来的点不包括源点汇点应该是ans*n*m*2点,为什么*2呢,因为每个除了'#'点拆成2个点...
阅读全文
摘要:看题意看了半天你敢信===L代表几只蜥蜴的初始位置,一次可以跳到距离 3 #include 4 #include 5 #include 6 #include 7 #define maxn 100005 8 #define maxm 200005 9 #define inf 0x3f3f...
阅读全文
摘要:把以前没做的网络流模型现在都补一下==本题是比较经典的只有点权,题目问在哪些点放置东西使不流通代价最小,拆点然后就是最小割,跑一遍最大流即可对于点i,i->i+n x对于双向边 x+n->y inf y+n->x inf 1 #include 2 #include 3 #include 4...
阅读全文
摘要:额这题卡了dinic的时间==不过还是强行用dinic过了,把stl语句全部换了,包括vector也改成了邻接表还是比较慢,8000+ms,很奇怪的是,我的邻接表中加了当前弧优化竟然慢了1s===至于sap,过两天再写吧== 1 #pragma comment(linker,"/STACK:1677...
阅读全文
摘要:边容量即为所填数 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define inf 0x3f3f3f3f 7 struct Edge 8 { 9 int from,to,cap,...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 #define inf 0x3f3f3f3f 9 struct Edge{ 10 int ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #define inf 0x3f3f3f3f 8 using namespace std; 9 int min(int xx,int yy) 1...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #define inf 0x3f3f3f3f 6 using namespace std; 7 int flow[20][20],cap[20][20],a[20],p[20],n; 8 int ek() ...
阅读全文