Problem code- ITGUY15
This code is working everywhere but codechef is showing runtime error and I am not able to find the reason for this so please help.
#include<bits/stdc++.h> #include
using namespace std;
In the above line of code , you are accessing out of bound memory address for vector when i=v.size()-1 and v.size()-2 as v.size()-1+1=v.size(), which is out if bound .
To remove SIGSEGV you can push back any two random letter in the vector other than a,b,c
@dhruv788
Can you tell me something regarding What steps did you follow from starting competitive coding to till now to get such higher rating and maintaining it so well You are genius
Plz reply that help me to get some idea what path should I follow to become such a good like you or even some close to you
I am not . I think I reached 5 star by luck .
I refered to CP algorithms, and youtube channel named Code NCode for learning Algos . Solved problems on these Algos on some sites.Though Now a days , Questions related to Algos have decreased in CP , but still I think you will have to learn some important CP Algos . But do give contest regularly atleast on one platform, Because now a days most of the CP contests question are logic based
@dhruv788 I did the same what you told and also another approach was that I ran the loop of i till v.size()-3 i.e i+2<v.size() so that it does not go out of bound. But it is still showing runtime error. Is there any other way or can you once try it yourself and tell.
The runtime error(SIGSEGV) is caused due to the line 20 . There you are continuously doing it1+=i
Whereas I think either you should it1++ before the if statement or inside if statement make it1=v.begin() and then do it1+=i
Refer the correction I did below https://www.codechef.com/viewsolution/40548079