INOI 2016 Discussion

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)

My code is here: WEALTH_DISPARITY

Can anybody please tell me what exactly this error means and why am I getting this error?

I used Rajatā€™s solution, O(n^3), but I am getting TLE for 2nd sub task. Can anyone please suggest a faster solution ?

Subtask 1 of each problem was 40 pts. I got 140 on pretests (dfs+brute)

1 Like

High 5 anukul. Got 140 on pretest too.

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.

It just said I got x/y cases right. Didnā€™t tell me any reason.

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.

I did plain dfs(node, max_of_subtree). do you think it will result in RE? I used a vector btw, so all elements are on the heap.

dfs will AC , 10^5 recursion easily works without any problem

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.

Will O(n^3) pass?

INOI cutoff is the same for everyone.

I assumed it to be negative instead of 0. Didnā€™t pass for me. Could that possibly be the reason?

Okay. Whatā€™s going to be the expected cutoff according to you and what was the cutoff last year?

I think so, yeah. Also what were you printing if there was no correct bracket subsequence?

aah I didnā€™t quite think about that. my program would print -10^8 :stuck_out_tongue: