摘要: 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要了数据才过的。而且代码写的不好。将就看一下吧。
阅读全文