摘要: A O(NM) dynamic programming algorithm is quite apparent after sorting the computers and network interfaces by their coordinates. Furthermore, in any optimized case, for each computer the difference between the the indices of the network interfaces matching to and closest to the computer is never larger than N. So the complexity could be reduced to O(N2)
有很多細節不好考慮,應該是我的水平原因。最后我向updog要了數據才過的。而且代碼寫的不好。將就看一下吧。
閱讀全文