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

Revision en1, by 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?

Tags tree, dp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English usernameson 2025-04-22 16:51:33 646 Initial revision (published)