优先队列运用 TOJ 4123 Job Scheduling】的更多相关文章

链接:http://acm.tju.edu.cn/toj/showp4123.html 4123.   Job Scheduling Time Limit: 1.0 Seconds   Memory Limit: 65536K Total Runs: 130   Accepted Runs: 29 Given N jobs, each denoted by a 2-tuples integer (pi, ri) where pi is the processing time and ri is…
传送门 这个题类似于建筑抢修. 先按照时间排序. 如果当前时间小于任务截止时间就选, 否则,看看当前任务价值是否比已选的任务的最小价值大, 如果是,就替换. 可以用优先队列. ——代码 #include <queue> #include <cstdio> #include <iostream> #include <algorithm> #define LL long long ; int n; LL tim, ans; struct node { LL x,…
约翰有太多的工作要做.为了让农场高效运转,他必须靠他的工作赚钱,每项工作花一个单位时间. 他的工作日从0时刻开始,有10^8个单位时间.在任一时刻,他都可以选择编号1~N的N(1 <= N <= 10^6)项工作中的任意一项工作来完成. 因为他在每个单位时间里只能做一个工作,而每项工作又有一个截止日期,所以他很难有时间完成所有N个工作,虽然还是有可能. 对于第i个工作,有一个截止时间D_i(1 <= D_i <= 10^9),如果他可以完成这个工作,那么他可以获利P_i( 1<…
1. 队列概述 队列和堆栈都是有序列表,属于抽象型数据类型(ADT),所有加入和删除的动作都发生在不同的两端,并符合First In, First Out(先进先出)的特性. 特性: ·FIFO ·拥有两种基本操作,即加入与删除,而且使用front与rear两个指针来分别执行队列的前端与尾端. 如定义int[] queue= new int[int max]; 当rear为max-1时,认为队列已满(Queue-Full),新的数据不能再加入.此时可以将队列中的数据往前挪移,移除空间让新数据加入…
排列2 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5437    Accepted Submission(s): 2072 Problem Description Ray又对数字的列产生了兴趣: 现有四张卡片,用这四张卡片能排列出非常多不同的4位数,要求按从小到大的顺序输出这些4位数.   Input 每组数据占一行,代表四张卡片…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4123 Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 问题描述 Bob wants to hold a race to encourage people to do sports. He has got trouble in choosing the route. There are…
P2949 [USACO09OPEN]工作调度Work Scheduling 题目描述 Farmer John has so very many jobs to do! In order to run the farm efficiently, he must make money on the jobs he does, each one of which takes just one time unit. His work day starts at time 0 and has 1,000…
1603: Scheduling the final examination Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 49  Solved: 15 Description For the most of the university students,what they most want is that they can obtain 60 points from the final examination of every subjec…
P2949 [USACO09OPEN]工作调度Work Scheduling 题目描述 Farmer John has so very many jobs to do! In order to run the farm efficiently, he must make money on the jobs he does, each one of which takes just one time unit. His work day starts at time 0 and has 1,000…
Bob’s Race Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4123 Description Bob wants to hold a race to encourage people to do sports. He has got trouble in choosing the route. There are N houses and N - 1 roads…