二分一下答案就好了... ---------------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<iostream>   #define rep( i , n ) for( int…
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1620 题意: 有n个工作,每一个工作完成需要花费的时间为tim[i],完成这项工作的截止日期为dead[i]. 问你在保证所有工作按时完成的前提下,最晚什么时候开始工作. (每天从时刻0开始算.如果无论如何都完成不了,输出-1) 题解: 贪心. 先将所有工作按dead从大到小排序. 当前开始工作的时间为start(初始为INF). 对于每个工作,start一定要满足两个条件: start…
Description Ever the maturing businessman, Farmer John realizes that he must manage his time effectively. He has N jobs conveniently numbered 1..N (1 <= N <= 1,000) to accomplish (like milking the cows, cleaning the barn, mending the fences, and so…
Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 920  Solved: 569[Submit][Status][Discuss] Description Ever the maturing businessman, Farmer John realizes that he must manage his time effectively. He has N jobs conveniently numbered 1..N (1 <= N <= 1,0…
按s从大到小排序,逆推时间模拟工作 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=1005; int n; struct qwe { int s,t; }a[N]; bool cmp(const qwe &a,const qwe &b) { return a.s>b.s; } int read() { int r=0,…
1620: [Usaco2008 Nov]Time Management 时间管理 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 506  Solved: 306[Submit][Status] Description Ever the maturing businessman, Farmer John realizes that he must manage his time effectively. He has N jobs convenien…
http://www.lydsy.com/JudgeOnline/problem.php?id=1620 一开始想不通啊.. 其实很简单... 每个时间都有个完成时间,那么我们就从最大的 完成时间的开始往前推 每一次更新最早开始时间(min(ans, a[i].y)代表i事件最早的完成时间) #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <…
Description Ever the maturing businessman, Farmer John realizes that he must manage his time effectively. He has N jobs conveniently numbered 1..N (1 <= N <= 1,000) to accomplish (like milking the cows, cleaning the barn, mending the fences, and so…
1229: [USACO2008 Nov]toy 玩具 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 338  Solved: 136[Submit][Status][Discuss] Description 玩具 [Chen Hu, 2006] Bessie的生日快到了, 她希望用D (1 <= D <= 100,000; 70%的测试数据都满足 1 <= D <= 500)天来庆祝. 奶牛们的注意力不会太集中, 因此Bessie…
[题木链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1229 [题目大意] 每天对玩具都有一定的需求ni,每天可以花f价值每条购买玩具, 当天用完的玩具可以花费fA价值每个通过快消毒在A天之后得到一条可用的, 也可以通过花费fB价值每个,通过慢消毒在B天之后获得可用的 问满足每天需求所用的最小花费. [题解] 这是纸巾问题的费用流模型,费用流做法见 BZOJ 1221 [HNOI2001] 软件开发 但是我们发现N=100000的规模完全…