Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

SQRT-optimization in graph task

$
0
0

I have a task:

Given a tree with n vertices. From the start all the vertices are not painted. For O((n+q)*sqrt(n+q)) need to answer to q requests:1) paint vertice V;2) find the closest to the V painted vertice.

I split all the vertices in heavy and light (heavy - vertices with power >= sqrt(n)) and try to do task for heavy directly and count answer "by hands" for light, but I'm stuck :(


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>