This is an approximate problem.
You are given 2 numbers n and m and a n×n matrix C. Construct an array a of length n whose sum is equal to m so that the following value ∑ni=1∑nj=1C[i][j]⋅(ai−aj)2 is minimized.
Input
The first line contains 2 integers - n,m.
The next (i+1)th(1≤i≤n) line contains n integers - C[i][1],C[i][2],…,C[i][n](C[i][i]=0,C[i][j]=C[j][i]).
There exists three types of test cases and constraints are determined for each type. Please read the "Tests" section below in order to check the constraints.
Output
Output n nonegative integers - a1,a2,…,an (0≤ai≤m).
The array a must satisfy the condition ∑ni=1ai=m.
Scoring
The final score is equal to ∑ni=1∑nj=1C[i][j]⋅(ai−aj)2.
Tests
There will 99 tests with three types of generation:
n=32 and m is chosen uniformly from interval [4072,4088], C[i][j](1≤i<j≤n) is uniformly chosen from interval [0,220].
n=256 and m is chosen uniformly from interval [3841,4096]. A permutation p is uniformly chosen and a tree is created with vertices (pi,pqi) (1<i≤n) where qi is uniformly chosen in interval [1,i−1]. After this C[pi][pqi] (1<i≤n) is uniformly chosen in interval [0,222] while all other values in array C are equal to 0.
n=256 and m is chosen uniformly from interval [3841,4096], C[i][j](1≤i<j≤n) is uniformly chosen from interval [0,214].
After the contest, 99 new tests generated with a different seed will be uploaded and the solutions will be evaluated on these tests.
Please note that sample input is not satisfied any constraint above. Array a is equal to (1,1,2) and the score is equal to 2⋅(1⋅(a1−a2)2+1⋅(a2−a3)2+1⋅(a3−a1)2)=2⋅((1−2)2+(2−1)2)=4.