Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)
In this problem you have to find the dual to the linear programming problem given in general form.
Linear programming problem is set in the following way. For i = 1, 2, ... , n let xi be a variable. Some xi may be required to be non-negative or non-positive. The goal is to minimize or maximize the sum c1x1 + c2x2 + ... + cnxn under a set of restrictions.
Let A = (aij) be an m*n matrix. Denote the product ai,1x1 + ai,2x2 + ... + ai,nxn as Aix. Each restriction has the form Aix >= bi, Aix <= bi or Aix = bi.
Dual to this linear program is defined as the linear program with variables yi for i = 1, 2, ... ,m (the number of dual variables is equal to the number of restrictions in the primal problem). If the primal problem was a minimization problem, the dual is a maximization one and vice versa. The objective function of the dual problem is b1y1 + b2y2 + ... + bmym.
Each dual variable is associated with the restriction of the primal problem. If the primal problem was a maximization one, variables, associated with Aix <= bi restrictions must be non-negative and variables associated with Aix >= bi restrictions must be non-positive. In case the primal problem was a minimization one, the variables, associated with Aix >= bi restrictions must be non-negative and variables associated with Aix <= bi restrictions must be non-positive. Variables associated with Aix = bi restriction may be arbitary in either case.
The restrictions in the dual problem use matrix AT (A transposed) instead of A. Restricitions have one of the form AiT yi <= ci, AiT yi >= ci, or AiT yi = ci. You must determine the type of the restriction using the idea that the dual to the dual problem is the primal problem again.
Given primal linear programming problem, output its dual.
The first line of each test case contains n and m (1 <= n,m <= 100).
The second line of each test contains the objective function of the given problem. The first word of the line is either "min" or "max", the objective function follows. All ci are integer, xi is given as "xi", multiplication sign is omitted, minus sign may replace the plus sign when needed to state that ci is negative. Terms with ci = 0 are omitted. If all ci are zero, "0" is given as the objective function. Terms with ci = 1 or ci = -1 are given without '1' character.
The third line contains the word "with".
Next n lines contain non-negativity and non-positivity conditions for the variables. If the variable may be arbitary, the word "arbitary" is used.
The next line contains the word "under".
Following m lines contain restrictions, all aij and bi are integers, multiplication sign is omitted, terms with aij = 0 are omitted, if for some i all aij are zero, "0" is used as the left side of the equation. Terms with aij = 1 or aij = -1 are given without '1' character.
Input file contains no extra spaces.
For each test case, output the dual to the problem given in the input file, in the same format. Remember, that the first line must contain the number of variables and restrictions in the dual problem, so that the output file produced is the valid input file for the problem with the exception that it has 'y' instead of 'x'.
You must list variables in all statements in increasing order of their numbers and must omit terms equal to zero. You must omit +1 or -1 coefficient where needed, keeping only the sign. You must not print '+' if the following term has the negative coefficient.
Andrew Stankevich Contest 4