We consider a set of jobs 1, 2,..., n having processing times t1, t2,...,tn respectively. Job i arrives at time ai and has its deadline at time di. We assume that ti, ai, and di have nonnegative integral values. The jobs have hard deadlines, meaning that each job i can only be executed during its allowed interval Ii=[ai, di]. The jobs are executed by the worker, and the worker executes only one job at a time. Once a job is begun, it must be completed without interruptions. When a job is completed, another job must begin immediately, if one exists to be executed. Otherwise, the worker is idle and begins executing a job as soon as one arrives. You should note that for each job i, the length of Ii, di - ai, is greater than or equal to ti, but less than 2*ti.
Write a program that finds the minimized total amount of time executed by the worker.
Input
Output
Sample Input
3
3
15 0 25
50 0 90
45 15 70
3
15 5 20
15 25 40
15 45 60
5
3 3 6
3 6 10
3 14 19
6 7 16
4 4 11
Sample Output
50
45
15
题意: 有一位工人, 如果在当前时刻有工作他会执行, 不会休息, 但是他会偷懒, 现在又n个任务,
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
#define MAX 255
const int INF = (1<<29);
int n;
int t[MAX], a[MAX], d[MAX];
vector g[MAX];
int result;
inline int min(int a, int b)
{
}
void dfs(int curTime, int sumTime)
{
}
int main()
{
//
}