Problem B
Budget
I have a problem. I was supposed to make a budget proposal for this competition and I haven’t started yet. It must be done at the end of the competition or the others will notice that I haven’t done it. This is where I need you.
The budget proposal is a matrix where the rows represent the different kinds of expenses and the columns reptresent the different sites.
We had a meeting about this some time ago where we discussed the sums over different kind of expenses and sums over different sites. There was also some talk about special constraints: someone mentioned that Stockholm would need at least SEK 2000 for food and someone from Lund argued they wouldn’t use more than SEK 100 for paperclips. Anyway, I’m sure there was more, I’ll go and try to find some notes from that meeting if you write a program that can solve the problem when we get the data.
And, by the way, no one really reads budget proposals anyway, so you’ll just have to make sure that it sums up properly and meets all constraints.
Input
The first line of the input contains an integer
The first line of each test case contains two integers
Each constraint consists of two integers
There is an empty line before each test case.
Output
For each case output a matrix of non-negative integers meeting the above constraints or the string “IMPOSSIBLE” if no legal solution exists. Output an empty line between cases.
Sample Input 1 | Sample Output 1 |
---|---|
2 2 3 8 10 5 6 7 4 0 2 > 2 2 1 = 3 2 3 > 2 2 3 < 5 2 2 4 5 6 7 1 1 1 > 10 |
2 3 3 3 3 4 IMPOSSIBLE |