• + 1 comment

    Thank you very much for your explanations, thought I am stilll struggling to understand the math

    Though it seems to me that there is an error in the first line of your code. Perhaps

    vector<long> edges(100001);
    

    needs to be replaced by

    vector<vector<long>> edges(100001);