We study the flow-shop problem nonpreemptively scheduling $n$ jobs on $m$ machines to maximize the number of just-in-time jobs. This network type algorithm is based on a binary tree structure. We define the superiority relation of a partial schedule, and propose an efficient rule that searches only partial schedules extensible to optimal schedules. We show that this algorithm finds an optimal schedule for this problem in a low polynomial time.