Блог пользователя terserah

Автор terserah, 12 лет назад, По-английски

Is it possible to solve Uva 11790 using O(n log k) LIS? I kept getting WA using O(n log K) LIS, so i change to O(n^2) and get accepted. The problem's constraint is not clear though :(

Link : http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2890

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
12 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

If you have a correct solution, you can make a stress test and find a test where it's wrong.

»
12 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

It is possible to solve problem in N Log N using segment tree with queries Add(left = X, right = n, value = DX) and GetMax(left = 0, right = X). You don't need LIS.