|
|
back to boardWhy my algorithm WA #2? This is my algorithm. Can anybody tell me why I'm wrong. F(i,j) is the function return to the minimal unhappiness when you consider to the i-th horse and you have used j stables. So that with any k between j and i-1. F(i,j) = F(k,j-1) + the number of white horse multiple to the number of black horse between k and i. So my algorithm is O(n^3). If you can tell me, please send the hint to my email vietlong2110@gmail.com Re: Why my algorithm WA #2? k should be between j-1 and i-1. |
|
|