Help Ramu Problem

The link of question is:
https://hack.codingblocks.com/contests/c/255/104
The link of my code:
http://ide.codingblocks.com/#/s/16747

According to my code it’s passing the given test cases but after submission it’s giving wrong answer

Hi Aulick,
Don’t make dynamic arrays without using new keyword. Memory for arrays without using it are allocated at compile time. So, either make arrays of 1000 or with new. Otherwise, your logic is perfectly fine.

http://ide.codingblocks.com/#/s/16768
Still it’s giving error.

http://ide.codingblocks.com/#/s/16789
Try this

1 Like

Your code is working fine. Can you please tell what’s wrong with my code? I am not able to figure it out. Your logic seems similar to mine

Hey, there is no problem in your logic. The only reason it is failing some test cases is becoz you are not updating the values of sum1, sum2 to 0 in each test case. Try that. It should work

1 Like

Getting the same problem but my array initialization is correct. Please find below the link for my code and tell me where I am doing it wrong.
https://ide.codingblocks.com/#/s/29121

array initialisation is not correct.
int arr[] is not allowed
int arr[1000] or int arr[N] is allowed