I had a doubt how this solution clears large dataset of Kickstart Round B as it is (N*M*K) which is dp entries and each entry is approx (N*M). Lastly T test cases too and each of the variable, that is, N, M, K, T is in range 1,..,100.
[Link of solution](https://ideone.com/ZAOpvy)
[Link Of Problem](https://codejam.withgoogle.com/codejam/contest/11304486/dashboard#s=p2)
Am I making an error in understanding or test cases were weak as I tried locally on large dataset and it worked within 2 mins.