I am getting Incorrect ans in the que discussed by apaar sir in the video.
here is the link to my code.
I am getting Incorrect ans in the que discussed by apaar sir in the video.
here is the link to my code.
Also give me the que link to the hackerblock so that i can submit it.Please look to my code …It will be matter of second for u to solve it.
Please Resolve this doubt.
it will take quite a few second…please checck it once.
Q-There are N cities numbered from 0 to N-1. You have to choose 2 cities such that there is no path from first city to second city . You are given information in the form of M pairs (X,Y) i.e there is an undirected road between city X and city Y. Find out the number of ways in which cities can be chosen. Input Format: The first line contains two integers, N and M separated by a single space. M lines follow. Each line contains integers separated by a single space X and Y denoting road between X and Y. Constraints: 1 <= N <= 100000 1 <= M <= 100000 0 <= X,Y <= N-1 Output Format An integer that denotes the number of permissible ways to choose a pair of cities.
This is the input I have taken .5 3 0 1 2 3 0 4
@Kumarrituranjan2056 hey this problem is not available on havkerblocks i think ,so apko manually hi test cases check krne pdenge.
Isliye to maine manual test case diya apkko…us test case ka correct ans 6 hai but mera 9 aa rha
If no one can help , please send me the code discussed in the video.
It’s been more than 20 hour that my doubt is not resolved.
@Kumarrituranjan2056 hey bro sorry for late reply as my timings for doubts taking is at night,please tell me the name of question as if I have not seen the video.
Q-There are N cities numbered from 0 to N-1. You have to choose 2 cities such that there is no path from first city to second city . You are given information in the form of M pairs (X,Y) i.e there is an undirected road between city X and city Y. Find out the number of ways in which cities can be chosen. Input Format: The first line contains two integers, N and M separated by a single space. M lines follow. Each line contains integers separated by a single space X and Y denoting road between X and Y. Constraints: 1 <= N <= 100000 1 <= M <= 100000 0 <= X,Y <= N-1 Output Format An integer that denotes the number of permissible ways to choose a pair of cities.
Link to the que is expired .So i have only problem statement,
This is the test case. Input : 5 3 0 1 2 3 0 4 Output :- 6
@Kumarrituranjan2056 hey ,pls first check if number of components you are getting is correct for respective components. If its correct then just take ll int and multiply as required.
If thats wrong ,check what are you missing by printing your visited array.
@Kumarrituranjan2056 bro I have asked my senior for question link then only i can debug,also question ka name pta hai ,only name not statement.
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.