Run error in 1 testcase

link to code : https://ide.codingblocks.com/s/262385
I’m getting run error in one of the test case, what is wrong eith the code ?

@O17LPOLA020011
Your code and logic is correct. But the problem is you have not cleared beverage, revbeverage and your graph g for each testcase. It contains data from previous testcase. Just write these line at the end of solve() function
beverage.clear();
revbeverage.clear();
for(int i=0;i<1005;i++){ g[i].clear(); }

1 Like

@O17LPOLA020011
Here is the updated code. Please check here

still getting run error, now in both the testcases :upside_down_face:

@O17LPOLA020011
Can you please submit it at hackerblocks and tell whether it is running there or not because it’s passing both testcase when i submitted.
https://hack.codingblocks.com/app/contests/1107/522/problem

1 Like

1 Like

I submitted for the wrong question :sweat_smile:, sorry for the trouble, it’s working.
Thanks for the effort :relaxed:

@O17LPOLA020011
Please mark this doubt as resolved :grinning:

1 Like