Jack_Daniels_'s blog

By Jack_Daniels_, history, 2 weeks ago, translation, In English

I have a problem: given a tree on N vertices, I need to answer requests with 2 types:

1)Delete I-th edge if it's in the graph (or vice versa).

2)Find a maximum matching in a component including vertex X.

I have a solution: dfs with DP on tree to count maximum matching on each request, but N and Q <= 1e5 and I've TL. Please tell, how I can improve this?

My current solution

P.S. This is my first blog, please dont kill me for some possible mistakes:)

  • Vote: I like it
  • 0
  • Vote: I do not like it