Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

### witua's blog

By witua, 7 years ago, ,

Hi!

I'm glad to invite you to my short contest on codechef.com on Sunday, 18th. (Check your time zone here.) I also want to note that Anton_Lunyov help my a lot in preparing of the contest, thanks to him.

In order to take part in the contest you should be registrated on the site, you don't need a separate registration for the contest. The competition will consist of 5 problems for 2.5 hours, using the standard ACM-ICPC rules.

After the contest you can discuss problems here and public all your wishes for the next contests.

Good Luck!

P. S. Please also note that CodeChef is now using much faster judging server!

• +55

•  » » 7 years ago, # ^ | ← Rev. 11 →   +3 My approach is to divide into several cases.The number of pairs (C4, C7) is quite small when C7 > 2.C7 = 0 is trivial.C7 = 1 is probably the most tricky part. Let S4[i] is sum of F4 of the first i numbers. For each i, we need to count how many j in some segments [L, R] such that S4[i] - S4[j] <= i - j. Let T[i] = S4[i] - i, the condition becomes T[i] <= T[j]. This can be done by using Binary Indexed Tree (Fenwick Tree).