GDSUB : Sept Codechef Long Challenge video editorial

Difficulty : Easy-Medium


suggestions are always welcome for making this channel better.
You guys are requested to support this channel by subscribing.
Thank you.
Happy Coding.


can you elaborate the ‘main’ section of this code as im not able to understand the approach used by this person .

1 Like

It’s difficult to understands someone else’s code , it is much harder (and time consuming) if there are no comments , and brother since I am a little too busy , i can’t help you into this.
Try running dry run on that , that may help.

Mine should be more comprehensible:


Hi @ssjgz, congratulation on reaching 4*! Please, release the Editorials of LPAD and FUZZYLIN as well.


Thanks - looks like I’ll get my a$$ kicked next Long Challenge as I’ll be in Div 1 XD

I’ll see if I can get FUZZYLIN and LAPD done later today, but no promises. LAPD in particular I’m not very motivated about, as my code for it is so awful :confused:


Can someone explain what’s wrong with my approach?
I used the power sum symmetric polynomial recurrence.

I have implemented exactly what you have described in the video (Nice Video).
But out of 8, 2 test cases are right this exact thing happened with at the time of contest also.

Please help me out.

most probably because you are not applying mod operation with 10^9 + 7.

1 Like

Hmmm … I’m not sure. It passes 10’000 random, small-ish tests, but seems to have trouble with large-ish ones - for example, this one (I get the answer 57120030 for it - hopefully someone else can verify :))

power probably should be using lls instead of ints, but fixing this in your code still gives me the wrong answer.

Congratulations on reaching 4 stars! I’m sure that it’s just a matter of time till you reach 7 stars. Good job!

1 Like

Thanks, but based on this long challenge (where I couldn’t figure out DOOFST no matter how hard I tried!) I think I’ll be lucky to reach 5* XD

Speaking of which: I hope the DOOFST Editorial comes out soon - the suspense is killing me! Doubtless I’ll kick myself when I see it!

PS - great CHEFK1 Editorial + code! :slight_smile:


Thanks! You’re editorials are really good too! Before the contest ended, I thought that my code (I have made it look just like one of your heavily documented codes) for LAPD was short, sweet and pretty fast. But then, I looked at your code. How did you come up with those crazy optimizations?! You’re frikkin’ amazing!

1 Like

Thanks, but my LAPD one is a real mess (loads of bodges and hacks everywhere), and only a teeny bit faster than yours XD

1 Like

can somebody explain whats’s wrong with my code. I used dp

Solution link here

Yours seems to fail on the same testcase I posted here.

Oops I forgot that!!

Can you link the video please

happens sometimes , and I feel its completely normal

Same here buddy! Even i tried hard to solve DOOFST but couldn’t :sob: Let’s wait for editorial

1 Like