need help in problem suma

Правка en1, от hiddentesla, 2016-08-13 15:29:08

problem link: https://open.kattis.com/problems/suma

so its ben 3 days since im stuck in solving this problem, i solved a similar problem called islands : https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=360&page=show_problem&problem=2628

where my idea is do union find from backwards, (i.e start when all the land is flooded, then move time backwards, if for some time a land becomes unfloded, add it as a new single group, then if its neighbours are not flooded, do union() operation with its neighbour)

but in suma that does not apply, because if i work backwards, some trees would not stay "connected" permanently, because at some time, they will be different heights again, and im having troubles coming up with somthing. so can anybody give me some hints to solve this?

Теги union-find, kattis, #data structure

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский hiddentesla 2016-08-13 15:29:08 845 Initial revision (published)