Need help in optimization

Правка ru1, от Jack_Daniels_, 2024-12-07 18:16:50

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. How I can improve this?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Jack_Daniels_ 2024-12-07 20:34:04 153 Tiny change: '2 types:\n1)Delete' -> '2 types:\n\n1)Delete'
en1 Английский Jack_Daniels_ 2024-12-07 19:15:58 373 Initial revision for English translation
ru1 Русский Jack_Daniels_ 2024-12-07 18:16:50 373 Первая редакция (опубликовано)