Please see this and pls tell whats wrong in my code

check now =>


Also Ai should be long long int, you have taken it as int only. So do it accordingly
Have added comments also for better understanding.

with your code still 1 test case is not passed and i have also changed Ai to long long int and its still not working
what is wrong with my code?

I can see your submission in it, you haven’t declared Ai as long long int

You weren’t storing your cumulative sum in a frequency array. You were maintaining a cumulative frequency array and then you were sorting that cumulative array.
Dry run for few test cases. You will get the intuition.
Rest everything was correct in your code.

cum[i+1]=(((cum[i]+arr[i])%n)+n)%n;} i just edited this and it worked but your code and my code both cant pass test case 1
can i know what is test case 1

It’s very very long, declare your arr array like this
Long long int *arr = new long long int [n]
and then submit it.

still it didn’t passed test case a1

Wait let me check, I’ll let you know.

1 Like

Check now=>


accepting all test cases now, and have replied to chat also. You can see.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.