当前位置:网站首页>hdu 2647 Reward(拓扑排序)
hdu 2647 Reward(拓扑排序)
2022-08-09 18:34:00 【51CTO】
题目: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=23269
Description
Dandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble about how to distribute the rewards.
The workers will compare their rewards ,and some one may have demands of the distributing of rewards ,just like a's reward should more than b's.Dandelion's unclue wants to fulfill all the demands, of course ,he wants to use the least money.Every work's reward will be at least 888 , because it's a lucky number.
Input
One line with two integers n and m ,stands for the number of works and the number of demands .(n<=10000,m<=20000)
then m lines ,each line contains two integers a and b ,stands for a's reward should be more than b's.
Output
For every case ,print the least money dandelion 's uncle needs to distribute .If it's impossible to fulfill all the works' demands ,print -1.
Sample Input
2 1 1 2 2 2 1 2 2 1
Sample Output
1777 -1
让最小的人收到888money,比他大的加1,按照拓扑排序增长,最后求出总资金。
边栏推荐
猜你喜欢

优秀的 Verilog/FPGA开源项目介绍(三十一)- OFDM

Fully automated machine learning modeling!The effect hangs the primary alchemist!

ebook download | "Business executives' IT strategy guide - why enterprises should implement DevOps"
![[免费专栏] Android安全之Root检测和绕过(浅析)](/img/04/4170dea9c367c406fe3f36cb9c6501.png)
[免费专栏] Android安全之Root检测和绕过(浅析)

numpy中nan_to_num如何使用

2022.08.05_每日一题

ebook下载 | 《 企业高管IT战略指南——企业为何要落地DevOps》

Openharmony轻量系统实验--GPIO点灯

开源一夏 | 基于若依架构的列表详情展示

Tims中国上市进入倒计时:年亏3.8亿 估值降至14亿美元
随机推荐
一些自动化测试01
如何抑制告警风暴?
2022.08.08_每日一题
2022 RoboCom 世界机器人开发者大赛-本科组(省赛)-RC-u5 树与二分图
Bi Sheng Compiler Optimization: Lazy Code Motion
切绳子【洛谷P1577】【二分】
AttributeError: module 'click' has no attribute 'get_os_args'
韩国严厉监管元宇宙相关企业
[Free column] APK dynamic reverse application of Android security [Three Smali injection methods]
MySQL备份与恢复
重庆智博会|2022智博会到底有哪些看点?拭目以待
[免费专栏] Android安全之和平精英(FZ)APK逆向分析
Open Source Summer | List Details Display Based on Ruoyi Architecture
AttributeError: module ‘click‘ has no attribute ‘get_os_args‘
Leetcode 739.每日温度 单调栈
视频是主动学习吗?
全自动化机器学习建模!效果吊打初级炼丹师!
vim编辑器使用
ebook download | "Business executives' IT strategy guide - why enterprises should implement DevOps"
【Unity3D】2D动画