当前位置:网站首页>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,按照拓扑排序增长,最后求出总资金。
边栏推荐
猜你喜欢
随机推荐
C#/VB.NET:从PowerPoint文档中提取文本和图片
【Unity3D】2D动画
Detailed explanation of VIT transformer
An overview of Office 365 Groups and how to create them
源码编译安装与yum和rpm软件安装详解
[免费专栏] Android安全之动态代码注入技术(利用JDB调试APK)
Swift -- 数组高阶函数
Openharmony轻量系统实验--GPIO点灯
基于设计稿识别的可视化低代码系统实践
C#/VB.NET: Extract text and pictures from PowerPoint document
MQTT X Web:在线的 MQTT 5.0 客户端工具
pat链表专题训练+搜索专题
一些自动化测试01
AttributeError: module 'click' has no attribute 'get_os_args'
三面(技术 +HR 面试)网易,分享我的面试经验!(已拿 offer)
Office 365 Group概述以及创建方法
Leetcode 739.每日温度 单调栈
《痞子衡嵌入式半月刊》 第 60 期
毕昇编译器优化:Lazy Code Motion
[] free column Android run Android, her - as command of safety




![[免费专栏] Android安全之数据存储与数据安全【大集合】](/img/bc/9d71ff1de27156e11cde169022f4a1.png)




![[免费专栏] Android安全之Android奇淫run-as命令](/img/d5/771802eb57f24c1cf88657f5c5a724.png)