How would you create anti-random tests for this tree type problem type?

Правка en1, от usernameson, 2025-04-22 16:51:33

Assume you have problem where there's tree with 100000 vertices and you have to answer 100000 queries of the form (x,y) meaning root the tree at x and then calculate some property for the subtree rooted at y. Assume the problem is easy to solve with tree dp for a fixed root but not obvious how to use tree rerooting dp. You could pick 100 roots and random then pre-calculate the answers and hope for each query in at least one of these rooted trees x is not in the subtree rooted at y. How would you create a test case that has a high probability to break such an approach?

Теги tree, dp

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский usernameson 2025-04-22 16:51:33 646 Initial revision (published)