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…
二分一下答案就好了... ---------------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<iostream>   #define rep( i , n ) for( int…
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…
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…
http://www.lydsy.com/JudgeOnline/problem.php?id=1620 一开始想不通啊.. 其实很简单... 每个时间都有个完成时间,那么我们就从最大的 完成时间的开始往前推 每一次更新最早开始时间(min(ans, a[i].y)代表i事件最早的完成时间) #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <…
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…
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1620 题意: 有n个工作,每一个工作完成需要花费的时间为tim[i],完成这项工作的截止日期为dead[i]. 问你在保证所有工作按时完成的前提下,最晚什么时候开始工作. (每天从时刻0开始算.如果无论如何都完成不了,输出-1) 题解: 贪心. 先将所有工作按dead从大到小排序. 当前开始工作的时间为start(初始为INF). 对于每个工作,start一定要满足两个条件: start…
按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,…
P2920 [USACO08NOV]时间管理Time Management 显然的贪心. 按deadline从大到小排序,然后依次填充时间. 最后时间为负的话那么就是无解 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define re register using namespace std; int max(int a,int b){return a&…
P2920 [USACO08NOV]时间管理Time Management 题目描述 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 ba…