SP6819 ASSIGN5 - Yet Another Assignment Problem

Description

New semester is coming. As the class monitor, [Cathy Yin](../../../users/cathyyin/) is going to make necessary preparations. She has _m_ jobs to do, _n_ classmates are going to help her. Each job requires some classmates working on it for certain time, say the _i_-th classmate must work on the _j_-th job for _A $ _{ij} $_ minutes. As an OIer of great responsibility she wishes to finish all jobs as soon as possible. But a classmate can do only one job at a time, and two classmates can **not** do the same job at the same moment. For example, to decorate the classroom, Alpha must work on it for 3 minutes **plus** Beta works on it for 4 minutes, then one possible assignment will be ABABBAB, taking 7 minutes in total. Now she is going to make a detailed schedule specifying who is doing what at each moment. Jobs are independent and may be done in any order. Also for each job anyone can do it for arbitrarily long, but **not** longer than the required time _A $ _{ij} $_ . Anyone can be free at any time. Time for certain classmate doing certain work need **not** be consecutive. As her friend, you are to help her to work out the schedule minimizing the total time needed.

Input Format

First line of the input contains two positive integers _m_, _n_ (1

Output Format

First line contains single integer T, minimum time needed. Next line contains _n_ non-negative intergers (