Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Time complexity of this solution
Разница между en1 и en2, 25 символ(ов) изменены
I really don't mean to bother anyone, this has just been annoying me for a good amount of time.↵

The problem is [8
55F35G](https://codeforces.net/problemsetcontest/1760/problem/1800/FG). I seem to have a working [solution](https://codeforces.net/contest/1760/submission/206027800) but it's timing out at test 38. ↵

I thought my solution worked in O(n) but it clearly either doesn't or something else is very wrong. My thought process was that both makeWanted and dfs should work in O(n) since there are no loops in a tree, so solve() should be O(n) as well.↵

I'd be incredibly thankful if you could have a look and see where I'm wrong :)

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский fmoeran 2023-05-16 00:08:02 25
en1 Английский fmoeran 2023-05-15 23:35:26 658 Initial revision (published)