I really don't mean to bother anyone, this has just been annoying me for a good amount of time.↵
↵
The problem is [855F35G](https://mirror.codeforces.com/problemsetcontest/1760/problem/1800/FG). I seem to have a working [solution](https://mirror.codeforces.com/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 :)
↵
The problem is [8
↵
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 :)