Alice Bob play game Alice get n treasure chest ith contain a_i coin m key jth sell Bob b_j coinsfirstly Alice put lock chest there m type lock lock jth type open jth key to lock type j ith chest Alice pay c_ij dollar Alice number different type lock chest possibly zeroThen Bob buy key Alice possibly possibly open chest open chest key lock ch Bobs profit difference total number coin open chest total number coin spend buy key Alice if Bobs profit strictly positive great zero win game Otherwise Alice win gameAlice want lock chest matter key Bob buy win Bob positive profit of course wants spend minimum possible number dollar buying lock help determine win game dollar spend lock