Now there are n independent projects, each project is composed by several steps, each step is labeled, there are k workers are going to work on these projects.
Assume that each person can do only one step, and each step can only be done by a specific worker(it will be declared in input file). Each project has a order for its steps, for example, workers can operate the second step only if the first step has been done. when one person finished one step, then he can be assigned to another step immediately.


Task:Input the number of projects, and the number of steps of each project, and the worker corresponds to each step, and how much time it will take to finish the step. Try to find an algorithm to calculate the optimized time to finish all projects.
Example inputs:


2 3(2 projects, 3 workers)


3 1 2 2 3 3 5(for project 1, there are 3 steps, the first will be done by worker 1 takes 2 hours, the second will be done by worker 2 by 3 hours, the third will be done by worker 3 by 5 hours)


2 2 3 3 2(for project 2, there are 2 steps, the first will be done by worker 2 by 3 hours, the second will be done by worker 3 by 2 hours)


Output
11 ( the minimized hours to finish the whole project)



A problem seeking for algorithm
I think this is a member of a class of problems called scheduling problems. In particular I think it is the job shop scheduling problem. There are machines instead of people but the basic structure is the same. If I am right about this the prospects of a solution of this type of problem is bleak as problems with three machines have been proven to be strongly NP-hard. I have found a reference for this \_Handbook of scheduling: algorithms, models, and performance analysis\_By Joseph Y-T. Leung I was able to look at parts of it on google books. 


