What concepts did you learn in the July20 LONG contest? Thank you!

Well, Codechef and Organisers get a LOT of criticism. So I thought why not share some positive thoughts I feel right now.

Thank you Organizers. Thank you Admins.

  1. Chef and Dragons: First time I used Seg Tree with great efficacy in a proper contest. The moment I saw this - I realized that this is a STACK+SegmentTree+Lazy problem. I was half-hearted about attempting the contest but this one drew me in. Thank you for boosting my Segment+Lazy confidence.

  2. Weird Mul: I saw the rolling hash polynomial nature of the problem. I understood modular divisions rather well. I couldn’t solve this problem, but I could see how a given weird multiplication is like a substring.

  3. Expected Repetitions: I couldn’t solve this problem fully, but now I am aware that there exists a thing called Ukkonen suffix tree array. This is what I am going after next.

  4. Kirchoff’s Theorem and how spanning trees can be calculated from a matrix. Didn’t even attempt the problem though.

I now understand string hashing a little better.


This is why, to me, codechef is better than ‘speed programing only’ like codeforces.

If there were only short contests, I would not have to worry about learning about more advanced techniques - since those problems arise only after you have ranked up. A beginner will have to worry about basic DP, basic DS, sorting divide and conquer etc. Codechef Long allows testing upto limit.

Don’t tweak long contest. Don’t stop it. Don’t reduce its time. If you try to study up and solve all problems - 10 days is TOO less. Don’t worry too much about cheaters, let MOSS take out as much as they can.

Cheating can happen in short contests too. Especially in hostels. Especially when friends share a room and divide effort up.


What do I have to learn for doctor chef…? :slight_smile:

I knew segment trees and lazy . . . But was not able to apply in complex problems and now I am I think will be able to atleast can apply segtrees, thanks to Dragon problem.
I brushed up my Probability concepts too


Observation. And Implementation skills. It was a hard problem. I solved DragonDen First attempt but Dr Chef took more attempts.

Though I had a partial score for Expected Repetitions ! But I got to know about Z function and KMP pattern matching a little more !
Also for expected spanning trees Kirchoff’s Tree Theorom to calculate number of spanning trees possible using adjacency matrix and degree matrix was a new concept I came to know ! Kudos to setters !

1 Like

i also learned STACK+SegmentTree+Lazy implementation

1 Like

Great job.

Stack + Segtree + lazy - I didn’t learn these things in this contest (I learned seg/lazy due to another contest - BACREP).

But this problem was just the right amount of difficulty for me to confidently apply.

okay means …nothing like no special DS reqired for this besides STL etc.
Thanks :slight_smile:

i want codechef to give more question like these

Questions like these are around in codechef practice and SPOJ. But unless in an actual long contest where time is no excuse, one doesnt roll up sleeves and learn.

From it i learnt to observe and think how can a greedy approach be used in a clever way.


Meet in the middle technique. But I wouldn’t credit codechef for this. here is my comment on codeforces, which I posted after AtCoder’s beginner contest 173. Now I saw that LCMCONST can be solved with this.

1 Like