I am approaching the Wealth Disparity via a graph solution. My code is pasing all the testcases except one, which is showing the following error: RE (SIGABRT)(0.540000)
Do they even give TLE? In my epxerience during ZCO and INOI this year, my computer simply stopped responding and then they had to switch me over to another.
I tried the solution for brackets (the part where Iām storing on the stack) in the Codechef IDE and it passed. Hopefully Iāll get 100.
Also can anyone please award me points so that I can ask questions and comment? Iām new to Codechef and Competitive Programming so it would be appreciated a lot.
I searched and realised getting your answers upvoted gives you enough karma to comment and ask questions. Can anyone kindly upvote this answer or give me karma points? Thanks a lot.
You used the Recursive variant. Well N can go upto 10^5 and Iām not sure how much the stack can handle (the function call stack and you will call the function N times). Maybe you should do a google search. In my opinion it depends upon the underlying implementation and can vary from platform to platform. You should email them maybe.
I donāt think DFS will AC. DFS and Recursion are the same here (Basically you are maintaining a explicit stack instead of using the function call stack that is generated while using recursion)
Sorry. i thought you meant AC as RE. Yes DFS will AC. and so should recursion.
And is a vector stored on the heap? I thought that it is stored on the stack like an array.
Basically the vector header info is allocated on the stack whereas the actual data is stored on the heap. Looks like I wonāt have any problems with the memory management.