摘要:
有 n 个环形排列的仓库,每个仓库存储的货物数量不等。 请用最少搬运量使 n 个仓库的库存数量相同。搬运货物时,只能在相邻的仓库之间搬运。 每个点拆为in 和 out #include <iostream> #include <queue> #include <cstring> using name 阅读全文
摘要:
const int N =5005, M=1e5+100; #define inf 1e9 int all=1,hd[N],go[M],w[M],nxt[M],cost[M]; int S,T,n,m; int pre[N],mn[N],dis[N],vis[N],ans=0; void add_( 阅读全文
摘要:
求最少的路径数目覆盖DAG每个点(无点交集 #include<iostream> #include<algorithm> #include <queue> using namespace std ; const int N=500,M=5e5+5; const int inf =1e9+7; int 阅读全文