The PDF version of this problemset can be downloaded here.
The correct constraint is $1 \leq N, M, K \leq 40$, instead of $1 \leq N, M, K \leq 30$.
3 3 1
18
Migrated from old NTUJ.