DSA week 1-Smart Phone problem

,

My answer has been partially accepted but I am not able to rectify the mistake and it is showing “RE (SIGSEGV)” in subpart 2(70 marks). Here’s the link to my solution- solution. Please help.

1 Like

In second test case, The constraints are 5×10^5 you have declared an array of 5000 only.
Then too if we are correcting it it is giving TLE in subtask 2.
Here is the link to the submission without RE:
https://www.codechef.com/viewsolution/36045795
Try removing the TLE yourself tho.

Hint

Try sorting the array and the number of elements at greater index will be larger than the number.

1 Like