getting wrong answer with 3D dp on spoj on PHIDIAS problem

I have used 3D dp in this case i.e dp[i][j][k] where dp[i][j][k] means i have to maximize utilization of (i X j) rectangle with k options and i have given the answer as w*h - dp[w][h][n].

        dp[i][j][k] = dp[i][j][k-1];
        if(i>=w[k] && j>=h[k]){
            dp[i][j][k] = max(dp[i][j][k],dp[i-w[k]][j][k] + dp[w[k]][j-h[k]][k] + w[k]*h[k]);
            dp[i][j][k] = max(dp[i][j][k],dp[i][j-h[k]][k] + dp[i-w[k]][h[k]][k] + w[k]*h[k]);

i am getting wrong answer. please see it.

ya i know 2d solution, but what is wrong with this 3d. I have checked various test cases and it is giving correct answer same answer as given by your 2d solution, but what is wrong in this case. or if you can find the test case in which it gives wrong solution.

problem link: