Runtime Error

ANYONE PLEASE TELL ME THE PROBLEM IN MY CODE?

PROBLEM: https://www.codechef.com/problems/VOTERS

MY CODE: https://www.codechef.com/viewsolution/15923344

I AM GETTING RUNTIME ERROR(SIGSEVG).PLEASE HELP!!

Your concept is very well correct, but the problem statement has 1 constraint hidden. It is NOT necessary that elements of the array are \le 150000 as well. Meaning, the id of voters in voter list is as large as {10}^{7} , and for those cases your code gives a Runtime error due to index out of bound exception. Just increase the size of your array to {10}^{7} and you are good to go (almost) :slight_smile:

1 Like

thanx for help.
one more thing that in the problem statement I didn’t find any constraint that id of voters is as large as 10^7.how did you know?

I ran a checker program to verify the upper limit.