Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
402个结点就够了.如果有用电器需要用到插座A, 那么插座A连一条容量为1的边到汇点就好了, 没必要把所有用电器都当成新的结点哦. 1. 读插座: scanf("%d",&n); for(i=1;i<=n;++i){ scanf("%s",tmp); ++m[S][getN(tmp)]; } 2. 读用电器: scanf("%d",&M); for(i=1;i<=M;++i){ scanf("%*s %s",tmp); ++m[getN(tmp)][T]; } 3. 读适配器: scanf("%d",&n); for(i=1;i<=n;++i){ scanf("%s %s",&tmp,&tmp1); m[getN(tmp1)][getN(tmp)]=INF; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator