HDU1789(Doing Homework again)题解】的更多相关文章

Doing Homework again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6878    Accepted Submission(s): 4096 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he h…
Doing Homework again Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing…
Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the deadline, the teacher will r…
题目链接:https://vjudge.net/problem/HDU-1789 题目大意: 给出N个作业的截至日期,和N个作业不交所扣掉的分数,要求输出扣除分数做少的方案. 解析: 与上一道销售商品类似,将分数从大到小排序,找到deadline,如果它的期限没有被占用,就在该天写完,然后vis置1,如果占用,则从它的前一天开始向前查找有没有空闲的日期,如果有则占用,vis置1.这样就可以得到最大分数.然后用总分数减去得到最大分数即为扣除的最小分数. #include <cstdio> #in…
Doing Homework again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18294    Accepted Submission(s): 10648 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he…
题目链接:https://cn.vjudge.net/problem/HDU-1789 题意 小明有一大堆作业没写,且做一个作业就要花一天时间 给出所有作业的时间限制,和不写作业后要扣的分数 问如何安排作业,使被扣分最少 思路 因为有日期这个规定,所以可以提前写作业 有一个思路,复杂度是O(n^2) 就是先算得n天内的最小扣分的安排,然后在n+1天时用第n+1天期限的作业更新一边最小扣分安排 考虑时间1000ms规模1000个数据,O(n^2)太冒险,所以考虑贪心 贪心思路O(n) 为了让扣分最…
基础单调队列: #include<cstdio> #include<cstdlib> #include<iostream> #include<algorithm> #include<memory.h> #include<queue> using namespace std; priority_queue<int,vector<int>,greater<int> >q; struct in { int…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1789 题目大意: 给出N个作业的截至日期,和N个作业不交所扣掉的分数,要求输出扣除分数做少的方案. 思路: 贪心, 正确的策略是: 扣除分数大的先做 扣除分数相同,先截止的先做 做一件事的时候,从截止时间开始向第一天遍历,如果当天没有被作业占据则标记为占据.做这件事的日期越大越好. 如果不能满足3的条件,则为不能完成 #include<iostream> #include<cstdio&g…
6343.Problem L. Graph Theory Homework 官方题解: 一篇写的很好的博客: HDU 6343 - Problem L. Graph Theory Homework - [(伪装成图论题的)简单数学题] 代码: //1012-6343-数学 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<bitset&g…
HDU1789(Doing Homework again)题解 以防万一,题目原文和链接均附在文末.那么先是题目分析: [一句话题意] 给定任务分数和其截止日期,每日可完成一任务,输出当罚分尽可能小时的最小罚分. [题目分析] 由于写的时候就知道是贪心了(专项练习= =||),所以要设计贪心策略,但是应该先处理数据以便使用.由于要求罚分尽可能小,那么我们就根据罚分来排序.根据罚分从大到小排序,如果罚分相同则根据日期从小到大排序.(现在想想觉得似乎日期排不排都行..)那么我们的贪心策略应该尽可能保…