Hello, We would like to invite the Codeforces community to the CodeChef November Lunchtime 2018 sponsored by Sharechat — a contest you will surely enjoy competing in. This is a 3-hour contest with 5 problems to work on and it’s open to programmers across the globe.

The contest problems will be available in English, Hindi, Bengali, Russian, Mandarin and Vietnamese. In addition, there are some exciting job opportunities from ShareChat — India’s fastest growing social network for programmers across the globe. For more details, you may visit the November Lunchtime contest page.

I hope you will join your fellow programmers and enjoy the contest problems. Joining me on the problem setting panel are:

- Setter: Nots0fast (Rehim Memmedli)
- Tester: Arpa (AmirReza PoorAkhavan)
- Statement Verifier: xellos (Jakub Safin)
- Editorialist: Deadwing (Hussain Kara Fallah)
- Mandarin Translator: huzecong (Hu Zecong)
- Vietnamese Translator: Team VNOI
- Russian Translator: Fedosik (Fedor Korobeinikov)
- Bengali Translator: solaimanope (Mohammad Solaiman)
- Hindi Translator: Akash Shrivastava

#### Contest Details:

**Start Date & Time:**24th November 2018 (1930 hrs) to 24th November 2018 (2230 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone**Contest link:**https://www.codechef.com/LTIME66**Registration:**You just need to have a CodeChef handle to participate. For all those, who are interested and do not have a CodeChef handle, are requested to register in order to participate.**Prizes:**Top 10 school students each from Global and Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: https://discuss.codechef.com/questions/51999/how-do-i-win-a-codechef-goodie

(For those who have not yet got their previous winning, please send an email to winners@codechef.com)

Good Luck!

Hope to see you participating!!

Happy Programming!!

P.S. As tester, I encourage you to participate in the contest, nice problems are prepared.

codeforces round time->->atcoder contestlunchtime:)Oh no, Atcoder again announces a contest at the very last time. Have to skip it :(

mathematics rocks.

nice problems are there.

How to solve "Maximize It"??.

There will be editorial soon, but the main idea is binary search.

Ok...Thank you.

Does n*k*k with small constant pass in Median or is it intended ?

My solution (after the end of the contest) is in

O(N(K+M) +KM^{2}) and passes with 0.43s/2s. I'm guessingO(NK^{2}) would be unintended?Thanks. I will think of it.

I think M can be got rid easily if you replace everything above or equal to M with 1 and rest 0. Now you need Median to be 1.

I'm not sure what you mean by "get rid of M" so just to be clear: the reason that

Mappears in my complexity is that since all elements are distinct, there are less thanMelements <M(the 0s in your reformulation).I am not able to find any editorial till now.

I'll ask Hussain.

Now it's up. Thanks again

Why this solution gave WA but this one passed? for BPS

for test case:

your WA gives:

`1/3`

and correct ans is`2/3`

Thanks manuchroma, got the mistake. :)

What was it exactly?

Since next_permutation() generates only unique permutations , It was not counting all values of P.

I used

`next_permutation()`

for looping condition but did not assume the size of the denominator and incremented inside the loop itself.https://www.codechef.com/viewsolution/21696134

Yeah. Either do this way or run next_permutation() for m! times.