This is the link to the question :
https://codeforces.com/edu/course/2/lesson/7/1/practice/contest/289390/problem/C
This is the link to my solution
I am getting wrong ans on pretest 6
This is the link to the question :
https://codeforces.com/edu/course/2/lesson/7/1/practice/contest/289390/problem/C
This is the link to my solution
I am getting wrong ans on pretest 6
There is flaw in your approach. Dry run this case
5 9
join 2 3
join 1 2
join 2 4
join 4 2
add 3 13
add 5 74
add 1 39
join 5 4
get 4
you get 13, but answer should be 52
i know It is giving wrong answer in some test case …Please modify it as i am trying from yesterday… Please help
The approach is incorrect and may go n^2 even if you correct it. Please see this https://ide.codingblocks.com/s/333205, if you don’t understand how this works I’ll explain.
Is it working ? I still think this line could throw tle
for (auto it : gr[x]) points[it] += a;
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.