The PDF version of this problem can be downloaded here.
4 1 0 0 0 1 1 0 1 1 5 2 1 1 2 2 3 3 4 4 5 5 0
4 3
Migrated from old NTUJ.
Hsinchu icpc 2011