当前位置:网站首页>Luogu p1073 [noip2009 improvement group] optimal trade (layered diagram + shortest path)
Luogu p1073 [noip2009 improvement group] optimal trade (layered diagram + shortest path)
2022-06-25 08:02:00 【Mfy's little brother 1】
Luogu P1073 [NOIP2009 Improvement group ] The best trade ( Hierarchical graph + shortest path )
The question :
Digraph with point weight , The point weight of each point represents , The price at which the crystal ball is purchased or sold . Seek from 1 To n, Choose to buy crystal balls at one point , Then choose the maximum profit after selling the crystal ball at one point . A point can pass many times .
Ideas :
Method 1 : Shrinkage point +dp( A topological sort )
Method 2 : Hierarchical graph + shortest path :
The edge weight of each layer is 0, The weights connecting the points of the first layer to the points of the second layer are negative numbers of point weights , Means to buy at this point , The weight of the points connecting the second layer to the third layer is a positive number of the point weight , Means sell at this point
Because you have negative power , Can only run spfa
边栏推荐
猜你喜欢
将数据导入到MATLAB
How to resize an image in C #
To understand the difference between Gram-positive and Gram-negative bacteria and the difference in pathogenicity
产品经理专业知识50篇(四)-从问题到能力提升:AMDGF模型工具
深度学习系列48:DeepFaker
[deep learning lightweight backbone] 2022 edgevits CVPR
Importer des données dans MATLAB
Share the process requirements for single-layer flexible circuit board
Machine learning notes linear regression of time series
一文了解 | 革兰氏阳性和阴性菌区别,致病差异,针对用药
随机推荐
电子学:第010课——实验 8:继电振荡器
Set the textalign property of the label control in C to control the method of text centering
PCB board design - automatic layout 2021-10-15
Analysis and utilization of Microsoft Office Word remote command execution vulnerability (cve-2022-30190)
Matlab代码格式一键美化神器
Tips on how to design soft and hard composite boards ~ 22021/11/22
Is it safe to open an account through the haircut account opening link now?
【日常训练】207. 课程表
50 pieces of professional knowledge of Product Manager (IV) - from problem to ability improvement: amdgf model tool
2021ICPC网络赛第一场
深度学习系列48:DeepFaker
【补题】2021牛客暑期多校训练营6-n
Atlas conflict Remote Code Execution Vulnerability (cve-2022-26134 vulnerability analysis and protection
协议和服务的区别?
洛谷P2839 [国家集训队]middle(二分 + 主席树 + 区间合并)
Can bus working condition and signal quality "physical examination"
Introduction to the main functions of the can & canfd comprehensive test and analysis software lkmaster of the new usbcan card can analyzer
产品经理专业知识50篇(四)-从问题到能力提升:AMDGF模型工具
TCP的那点玩意儿
C#控件刷新