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].

```
lp(i,1,wd+1){
lp(j,1,ht+1){
lp(k,1,n+1){
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: SPOJ.com - Problem PHIDIAS