|
|
Someone who solved this problem, give some ideas, please. The answer is n^2 + floor(n/2) + 1. Place n^2 in top-left corner and proceed row-by-row, column-by-column. For every cell choose maximal unused value, such that its sum with left and upper numbers is <= that minimal sum. I have no idea why that works. The formula above was found empirically - these are minimal values when this greedy algorithm converges. Edited by author 24.07.2008 15:00 Real cheat! With this formula the problem is VERY easy! IMHO, without it - it would take much more time and efforts to get AC. What is idea for this priblem? I fill matrix for chess: n = 4 0101 1010 0101 1010 0 - smoll number 1 - big number Why my solve is wrong?((( I got WA4. During the contest our team didn't solve this problem because of the same logic. Now I understand that the same idea but with putting the biggest number in the conner is so simple... Thanks! I got AC. Is true idea (for 4): 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 1 Edited by author 27.11.2007 15:37 Edited by author 27.11.2007 15:38 i am using BFS with queue I think that matrix have some stucture but I don't now this. It is so easy try only with yourself it's always better :) |
|
|