Please help me with my code

my code is always printing NO in all cases,please help

problem link= Contest Page | CodeChef

code link = Solution: 43331385 | CodeChef

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

4 Likes

done sir

1 Like

I can tell you why you are getting SIEGSEV error.

for(int j = 1;j<a.size()-1;j++) 

should instead be

for(int j=1 ;j<a.size()-2;j++)

Again, I am not commenting on the logic, I am just telling you why your code could be giving SIEGSEV error.