CF546E Soldier and Traveling
Description
In the country there are $ n $ cities and $ m $ bidirectional roads between them. Each city has an army. Army of the $ i $ -th city consists of $ a_{i} $ soldiers. Now soldiers roam. After roaming each soldier has to either stay in his city or to go to the one of neighboring cities by at moving along at most one road.
Check if is it possible that after roaming there will be exactly $ b_{i} $ soldiers in the $ i $ -th city.
Input Format
First line of input consists of two integers $ n $ and $ m $ ( $ 1
Output Format
If the conditions can not be met output single word "NO".
Otherwise output word "YES" and then $ n $ lines, each of them consisting of $ n $ integers. Number in the $ i $ -th line in the $ j $ -th column should denote how many soldiers should road from city $ i $ to city $ j $ (if $ i≠j $ ) or how many soldiers should stay in city $ i $ (if $ i=j $ ).
If there are several possible answers you may output any of them.