The 2D range sum DP problem recurrence relation same as 836
only change is we have to consider submatrix wih max 1's and (not maxsum)
have a look at condition on line no 106
Problems has to be addressed else its state will be same or it will be more bitter but never be in a solved position.
Tuesday, June 25, 2013
Saturday, June 15, 2013
11242 Tour de France
This is complete search problem only catch in this problem to fix and round the ouput note cout at the end
435 Block Voting
This is problem of Complete search.Though problem statement is not clear it can be understood with the test case.It states to find no of winning combination including particular party. Search all combinations
10360 Rat Attack
But this could also solved in 1025^2 using dp using range sum.
take input and make entries in dp[1025][1025];
Preproccess the 1025x1025 array using :
dp[i][j]=dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+dp[i][j];
then, use recurrence relation to find max
dp[i+d][j+d]-dp[i+d][j-d-1]-dp[i-d-1][j+d]+dp[i-d-1][j-d-1]; for all (i,j) between d+1 to 1025-d
Tuesday, June 11, 2013
990 Diving for Gold
Sunday, June 9, 2013
494 Kindergarten Counting Game
Thursday, June 6, 2013
10363 Tic Tac Toe
10812 Beat the Spread!
but note test case if sum=0 and differece = 0 so if d > s then continue ; (and not d>=s)
10420 List of Conquests
just note use of map
573 The Snail
Tuesday, June 4, 2013
105 - The Skyline Problem solution
Subscribe to:
Posts (Atom)