Thanks a lot sir you helped me a lot.
Just do this
scanf("%d",&n);
int arr[n]
and your array would be ready.
Just a question if i have to make a if else statement if someone gives input other than 1 and 0
Well yeah, you could do that, but thatâs just overkill. Be assured that there wonât be any inputs other than 0 , 1 . Unless it is mentioned specifically in the question, illegal inputs wonât be present in competitions.
So, did you solve it finally?
new error is encountered called time exceeded
solution https://www.codechef.com/viewsolution/22077657
Itâs because you are using the same variable i for all the for loops which is messing up the conditions leading to TLE. Use different variables for each for loop.
did it sir finally ,it wonât happen if you didnât helped me
if had to ask you in future directly how can i ask?
Well, you can mail me at [email protected]
And yeah, Iâd suggest you to improve upon the basics of implementation and input/output before jumping on to solving questions from contests. Good luck!
thank you sir but can you please tell me how can i improve it so that i can work with it
I started coding on GeeksForGeeks first. It has well written solutions of all the problems along with proper comments and formatting. If you wish, you could learn the coding style from there.
All this is based on personal experience and if you wanna improve your basics from CodeChef, itâ s fine too.