付费下载
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、er Network解题题目来源:http解法或类型:网络流作者:/JudgeOnline/showproblem?problem_id=1459(No.1459)题目描述er NetworkTime Limit:2SMemory Limit:1000KTotal Submit:103 Accepted:40DescriptionAer network nected bysists of nodes (er sions,sumers and dispatchers) d win amounter transport lines. A node u may bes(u) = 0 ofer, ma
2、y produce an amount 0 = p(u) = pmax(u) ofer, maysume an amount 0 = c(u) = min(s(u),cmax(u) ofer, and may deliver anamount d(u)=s(u)+p(u)-c(u) ofer. The following restrictions apply: c(u)=0 foranyer sion, p(u)=0 for anysumer, and p(u)=c(u)=0 for any dispatcher.There is at most oneer transport line (u
3、,v) from a node u to a node vhe net; ittransports an amount 0 = l(u,v) = lmax(u,v) ofer delivered by u to v. Let=uc(u) be the um value ofer.sumedhe net. The problem is to compute theAn exle is in figure 1. The label x/y ofer sion u showst p(u)=x andpmax(u)=y. The label x/y ofsumer u showst c(u)=x an
4、d cmax(u)=y. The label x/yofer transport line (u,v) showst l(u,v)=x and lmax(u,v)=y. Theersumed is=6. Noticet there are othossible ses of the network but thevalue ofcannot exceed 6.InputThere are several data setshe input. Each data set encodes aer network. Iter sions), 0 =starts with fouregers: 0 =
5、 n = 100 (nodes), 0 = np = n (nc = n (sumers), and 0 = m = n2 (er transport lines). Follow m datatriplets (u,v)z, where u and v are node identifiers (starting from 0) and 0 = z = 1000is the value of lmax(u,v). Follow np doublets (u)z, where u is the identifier of aersion and 0 = z = 10000 is the val
6、ue of pmax(u). The data set ends with nc doublets(u)z, where u is the identifier of asumer and 0 = z = 10000 is the value ofcmax(u). All input numbers areegers. Except the (u,v)z triplets and the (u)z doublets, white spacan occur freely in input. Input datawhich do not terminate witain white span en
7、d of file and are correct.OutputFor each data set from the input, the progrr sumeds on the standard output thehe corresponding network. Eachum amount ofert can beresuls anegral value and is pred from the beginning of a separaine.Sle Input2 17 2132 (0,1)2013 (0,0)1(3,5)2(1,0)10 (0)15(0,1)2 (0,2)5(3,6
8、)5 (4,2)7(1)20(1,0)1(4,3)5(1,2)8 (2,3)1 (2,4)7(4,5)1 (6,0)5(0)5 (1)2 (3)2 (4)1 (5)4Sle Output156HThe s nodes,le inpontains two data sets. The er sion 0 with pmax(0)=15 anddata set encodes a network with 2 sumer 1 with cmax(1)=20, and 2er transport lines with lmax(0,1)=20 and lmax(1,0)=10. Theum valu
9、e ofis 15. The sed data set encodes the network from figure 1.SourceSoutheastern European Regional Programmingtest 2003解题思路这个题目可以采用网络流的模型来解决。在原图的基础上添加一个源点和汇点。对于每个er Sion,从源点引一条容量为pmax 的弧;对于每个sumer,引一条容量为 cmax 的弧到汇点;对于题目中给的三元组(u,v)z,从点 u 连一条容量为 z 的弧到点 v。显然这样构图是满足题目要求的。然后求这个网络的最大流即可。数据结构本题我采用的是邻接矩阵的方式来网络中的流量(fnn)和容量(cnn),在求可改进路的时候需要用一个队列 qn和可改进路的数组 fan。其中 n 是指网络中的顶点个数,由于原图中的顶点个数不超过 100,然后添加
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年重点排放单位碳核算数据质量内部管理制度建设与合规要点
- 2026年新能源锂电池模组PACK线电芯堆叠±0.02mm精度实现
- 河北省保定市满城区市级名校2026年初三下学期第三次(4月)月考生物试题含解析
- 山西省运城市芮城县重点达标名校2026年中考第三次质量调研化学试题试卷含解析
- 河北省邯郸市复兴区达标名校2026年初三下学期第十四次周考生物试题(B)试卷含解析
- 2026年湖南省长沙市教科所初三9月零次考试生物试题试卷含解析
- 山东省枣庄市薛城区临城重点名校2026年初三5月质量检测试题(A卷)生物试题文试题含解析
- 江苏省南京市三区联盟2026届初三下学期期中考试(月考3)化学试题含解析
- 2026年河北省石家庄市四十中学初三下学期阶段性测试(一)化学试题试卷含解析
- 2026年甲醇加注作业安全规程与地方管理办法编制要点
- 2026河北省公务员录用省市县乡四级联考8650人备考题库及1套参考答案详解
- (2025年)(完整)《中华人民共和国妇女权益保障法》知识竞赛题库及答案
- 2026年及未来5年市场数据中国密闭式冷却塔市场竞争格局及投资战略规划报告
- 法庭安全教育培训课件
- 2026年鄂尔多斯职业学院单招职业技能测试模拟测试卷附答案解析
- 月结正式合同模板(3篇)
- 雨课堂学堂在线学堂云《研究生生涯发展与规划(山大 )》单元测试考核答案
- 2026年滁州职业技术学院单招职业适应性测试题库参考答案详解
- 春季养肝课件
- 江苏省施工现场安全生产管理制度全套完整版
- 无法参加庭审申请书模板
评论
0/150
提交评论