ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1167. Bicolored Horses

Why my algorithm WA #2?
Posted by vietlong 11 Aug 2011 10:20
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?
Posted by Le Viet Thanh Long 11 Aug 2011 17:04
k should be between j-1 and i-1.