CF546E】的更多相关文章

CF546E Soldier and Traveling 题目描述 In the country there are \(n\) cities and \(m\) bidirectional roads between them. Each city has an army. Army of the i-th city consists of \(a_{i}\) soldiers. Now soldiers roam. After roaming each soldier has to eith…
题目描述 In the country there are n n n cities and m m m bidirectional roads between them. Each city has an army. Army of the i i i -th city consists of ai a_{i} ai​ soldiers. Now soldiers roam. After roaming each soldier has to either stay in his city o…
题意 给定 n 个城市,m 条边.人只能从走相邻边相连(只能走一次)的城市. 现在给你初始城市的每一个人数,再给一组每个城市人数.询问是否可以从当前人数变换到给定人数.如果能,输入"YES"并输出方案,不能则输出"NO". http://codeforces.com/contest/546/problem/E 思路 当∑a!=∑b时,肯定不能. 建一个超级源点s和超级汇点t,s到(1~n)连一条容量为a[i]的边,(n+1~2*n)到t连一条容量为b[i]的边,再将…