当前位置:网站首页>洛谷P1073 [NOIP2009 提高组] 最优贸易(分层图+最短路)
洛谷P1073 [NOIP2009 提高组] 最优贸易(分层图+最短路)
2022-06-25 06:43:00 【mfy的1号小迷弟】
洛谷P1073 [NOIP2009 提高组] 最优贸易(分层图+最短路)
题意:
带点权的有向图,每个点的点权表示,在该点购买或者卖出水晶球的价格。求从1到n,选择在一点购买水晶球,再选择在一点卖出水晶球后的最大收益。一个点可以多次经过。
思路:
方法一:缩点+dp(拓扑排序)
方法二:分层图+最短路:
每层边权为0,连接第一层的点到第二层的点的权值为点权的负数,表示在该点购买,连接第二层的点到第三层的点的权值为点权的正数,表示在该点卖出
因为有负权,只能跑spfa
边栏推荐
- Cifar-10 dataset application: quick start data enhancement method mixup significantly improves image recognition accuracy
- Sword finger offer II 027 Palindrome linked list
- Manufacturing process of PCB 2021-10-11
- 一次弄清楚 Handler 可能导致的内存泄漏和解决办法
- Three Siemens fire-fighting hosts fc18 are equipped with can optical transceiver for optical fiber redundant ring network networking test
- MySQL简单权限管理
- El input to add words to the tail
- 【QT】Qt 5 的程序:打印文档
- 个人域名和企业域名的区别
- 洛谷P2048 [NOI2010] 超级钢琴(RMQ+优先队列)
猜你喜欢

How much do you know about electronic components on PCB?

How to resize an image in C #

417-二叉树的层序遍历1(102. 二叉树的层序遍历、107.二叉树的层次遍历 II、199.二叉树的右视图、637.二叉树的层平均值)

用函数的递归来解决几道有趣的题

50 pieces of professional knowledge of Product Manager (IV) - from problem to ability improvement: amdgf model tool

Share the process requirements for single-layer flexible circuit board

【论文学习】《VQMIVC》

Importer des données dans MATLAB

取消word文档中某些页面的页眉

新版USBCAN卡CAN分析仪的CAN&CANFD综合测试分析软件LKMaster主要功能介绍
随机推荐
Application of can optical transceiver of ring network redundant can/ optical fiber converter in fire alarm system
JDBC-DAO层实现
Use the frame statistics function of the message and waveform recording analyzer royalscope to troubleshoot the accidental faults of the CAN bus
单位转换-毫米转像素-像素转毫米
剑指offer刷题(简单等级)
Can transparent cloud gateway caniot and candtu record can messages and send and receive can data remotely
Four software 2021-10-14 suitable for beginners to draw PCB
Importer des données dans MATLAB
LeetCode_哈希表_中等_454.四数相加 II
网络模型——OSI模型与TCP/IP模型
饮食干预减轻癌症治疗相关症状和毒性
Introduction to the main functions of the can & canfd comprehensive test and analysis software lkmaster of the new usbcan card can analyzer
Modular programming of LCD1602 LCD controlled by single chip microcomputer
微信小程序开通客服消息功能开发
Keil and Proteus joint commissioning
Six causes of PCB disconnection 2021-10-20
27. 移除元素
深度学习系列48:DeepFaker
【视频】ffplay 使用mjpeg格式播放usb摄像头
Five causes of PCB board deformation and six solutions 2021-10-08
