Topcoder Zoo problem