Solution to MAXREV

Does anyone have ideas on how to solve the problem, here is the link CodeChef: Practical coding for everyone

First find MST based on repair costs and then build bipartite graph based on depth of nodes. Min cost max flow seems the answer to me. I didn’t get AC though.

What approach did you try? @nots0fast

I did same, but the number is 5*10^5 , it TLEs and I think it should TLE ? ( I am not sure )

Yes, I too think so. I got WA and RE instead of TLE though, idk why.

Please find the link to the editorial: MAXREV