long long is not working …It fails on testcase 8.
Code is perfectly fine ,no issues with code logic and wrong approach ,just it not running for very big values .
I read the tutorial and found 64bit variable to store final answer.
also found a method like this
int var=INF;
and taking min(arr[i] ,var)
//The question is a cakewalk just we need to to dfs including cas of disconnected graph .
My submission:Submission #88430254 - Codeforces
Question Link:Problem - C - Codeforces
tutorial:Educational Codeforces Round 33 Editorial - Codeforces
Please help U can also see the tutorial .