The PDF version of this problem can be downloaded here. The whole problemset as one file can be downloaded here.
2 4 0 1 1 2 1 3 5 0 1 1 2 1 3 0 4
Case 1: 2 Case 2: 3
Migrated from old NTUJ.
2011 ICPC Phuket