HDOJ-2647-Reward(拓扑)
来源:互联网 发布:java socket bind 编辑:程序博客网 时间:2024/06/15 21:56
Reward
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5771 Accepted Submission(s): 1762
Problem 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.
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.
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 11 22 21 22 1
Sample Output
1777-1
0 0
- HDOJ-2647-Reward(拓扑)
- HDOJ 2647 Reward (拓扑排序)
- hdoj 2647 Reward【拓扑排序】
- HDOJ 2647 Reward(分层拓扑排序)
- HDOJ 2647 Reward 【逆拓扑排序+分层】
- hdoj 2647 Reward 【反向拓扑 队列实现】
- hdoj 2647 Reward(逆向拓扑排序+队列)
- HDOJ 2647 Reward (反向拓扑排序)
- hdoj 2647 Reward 【逆向拓扑排序 队列】
- HDOJ 2647 Reward(反拓扑+统计节点)
- hdoj 2647 Reward(拓扑排序+队列)
- Hdoj 2467 Reward(拓扑排序)
- HDOJ 题目2647 Reward(拓扑排序,邻接表建图)
- hdoj 2647 Reward ( 拓扑排序--邻接表+队列 )
- hdoj 2647 Reward
- HDOJ 2647 Reward
- hdu 2647 Reward 拓扑排序
- hdu 2647 Reward 拓扑排序
- TCP/IP详解 卷I:协议 のping和traceroute
- oracle用触发器实现插入记录序列自增长(也可以指定记录序号)
- iOS开发 -- "AppDelegate.m"文件 程序启动流程
- 设计模式笔记(三)--装饰者模式
- 通过Hibernate的hbm.xml文件生成数据库表
- HDOJ-2647-Reward(拓扑)
- hdoj1869 六度分离(dijstra——floyd)
- 深入理解Java中为什么内部类可以访问外部类的成员
- HDOJ-2680-Choose the best route(最短路)
- android客户端和java服务端用aes加密结果不一样的解决方法。
- 软件对未来生产的作用
- 【Android开发】解决安卓android.os.NetworkOnMainThreadException
- 【Android】HTTP里的线程问题
- db2 专用工具 版本设置sql自动提示