You are not logged in. Please login at to post your questions!


Invitation to CodeChef August Long Challenge 2018 sponsored by ShareChat!

Hello CodeChef Community!

We are thrilled to invite you to participate in the August Long Challenge 2018 sponsored by ShareChat. In addition, there are some exciting internship and full-time job opportunities by ShareChat for Indian programmers in the August Long Challenge 2018. For more details, you may visit the contest page. I hope you will join your fellow programmers and enjoy the contest problems. Joining me on the problem setting panel are:

Contest Details:

Time: 3rd August 2018 (1500 hrs) to 13th August 2018 (1500 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone.

Contest link:

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.

This question is marked "community wiki".

asked 02 Aug '18, 20:09

mgch's gravatar image

accept rate: 20%

edited 02 Aug '18, 21:46

l_returns's gravatar image



Codechef's MikeMirzayanov profile page shows Could not find page you requested for. xD

(02 Aug '18, 20:18) aryanc4035★

@aryanc403 Do you propose to create MikeMirzayanov page on CodeChef?! XD

(02 Aug '18, 20:20) mgch6★

I'm assuming there was typo with username of Codechef's MikeMirzayanov. So, I'm correcting it. If this is not the case then please redo correction. And ban newly linked profile on account of giving false info. xD

(03 Aug '18, 18:42) aryanc4035★

@aryanc403 What is this Mike doing here?! ;)

(03 Aug '18, 19:53) mgch6★

@mgch Translating questions into hindi.
On a (serious)(xD) note on CodeForces (maybe due to existance of real MikeMirzayanov over there). Codechef's MikeMirzayanov name is not present there .
P.S. - Now I'm waiting to see what will happen now. Will real MikeMirzayanov overturn effect due to non presence of CodeChef's MikeMirzayanov name over there or not.

(03 Aug '18, 20:13) aryanc4035★

Why discuss @Mike when we already got a hardworking @admin tiring herself day and night for you guys to discuss about? ;)

(03 Aug '18, 20:23) vijju123 ♦♦5★

Codechef's MikeMirzayanov xD.

(03 Aug '18, 20:53) aryanc4035★

has any1 recieved the laddus for july long challenge ?

(05 Aug '18, 21:03) vivek_19982996★

yup, received them today

(06 Aug '18, 20:38) sarthakmanna6★

yeah... :)

(06 Aug '18, 21:58) vivek_19982996★
showing 5 of 10 show all

I have a doubt in problem INTERACTIVE MATRIX problem statement. Can I ask it here? I asked it in comments sections 3 days ago but no one replied yet :(


answered 07 Aug '18, 21:47

pshishod2645's gravatar image

accept rate: 13%

@admin @mgch please someone reply :(

(07 Aug '18, 23:32) pshishod26454★

The problem statements are very much clear. I didn't had any doubt while reading. May be you just need to read the problem more carefully!

(09 Aug '18, 17:01) meet2mky4★

Maybe you don't have but I HAVE DOUBT. if you understand something doesn't guarrante that everyone will understand it..

(09 Aug '18, 21:50) pshishod26454★

I liked all these problems, and they're all easy to understand, even MYST is clear when carefully read. Don't know why so much question in coordinate compression. But I have problem with that idiot prince. 4 days ago I thought I found the solution and got 10 points with quick coding, and good partially correct answers. Improved it a lot with hundreds of custom tests, fixed little bugs since then but after 4 days later I'm still getting the exactly same result. Now I'm stuck and don't wanna touch to any other problem... I'm gonna kill that prince myself.. or let me try to put a big sign saying "Sorry prince but our princess is on another land" :P


answered 10 Aug '18, 01:26

tieros's gravatar image

accept rate: 11%

Great problems. This was the first time I competed in Div 1 and it really was educational. Kudos to the setter and tester for making the problems challenging.


answered 13 Aug '18, 15:54

ruddradev's gravatar image

accept rate: 7%

@admin I cannot open . Getting all sort of 500, 504 errors.


answered 13 Aug '18, 18:27

aryanc403's gravatar image

accept rate: 10%

Submissions taking ~6 min to give verdict.


answered 04 Aug '18, 22:22

aryanc403's gravatar image

accept rate: 10%

Exactly, waiting for 5 mins here!

(04 Aug '18, 22:56) arnavvarshney3★

@mgch @likecs, Just want to bring it to your notice, that the test cases for GCDMOD are very weak.

My submission which takes O($10^{12}$) operations in the worst case got 100 points. Please look into it.


answered 05 Aug '18, 09:23

pshishod2645's gravatar image

accept rate: 13%

@pshishod2646, your complexity analysis is wrong. I will explain it later after the contest.

(05 Aug '18, 16:27) likecs6★

@likecs - Did you saw my latest solution?

(05 Aug '18, 16:41) vijju123 ♦♦5★

@likecs you might have seen my latest solution (the correct one)... And I am damn clear about my time complexity analysis....I even run my code on my PC for worst case...IT DIDN'T OUTPUT ANYTHING EVEN AFTER 10 MINUTES...

(05 Aug '18, 17:43) pshishod26454★

If you want they I can send you my code along with the worst case.

(05 Aug '18, 17:45) pshishod26454★

@likecs If the intended solution is same as mine then let me tell you that I know that though time complexity seems O(Something) but it is much less than that..But there is a corner test case for which it is really O(Something) and it time outs!!

(05 Aug '18, 17:49) pshishod26454★

@pshishod2645 - I think that its best to discuss this in comments section of the problem, or over mail or a private channel with @likecs , as you both can discuss to your hearts content there :). I also dont want anything like "@pshishod2645 discussed things related to contest but wasnt banned but my friend got banned wtf" since I am actively banning people. Hope you understand my dilemma :)

What I can confirm is, that the problem is solvable :)

(05 Aug '18, 18:17) vijju123 ♦♦5★

Don't ban me please :( :( :(

@vijju123 I didn't discussed anything about the problem statement or solution, I am just pointing out a bug.

OK!! I will shut my mouth....Humanity is getting extinct with time xD

(05 Aug '18, 18:25) pshishod26454★

Lol I am not saying you did anything wrong. Its just that people make a mountain out of a small matter at times. Hope you understand :)

(05 Aug '18, 18:29) vijju123 ♦♦5★


It's ok.
I am seeing this thread from last 2 hrs.
I have nothing to say or complain.
But "time complexity seems O(value was present here but has been edited now)" isn't allowed either. Afaik disclosing time complexity of soln is also not allowed.
It's ok but please be careful.


P.S. - For e.g. - Give me expected time complexity for KCOMPRES . I will bring a soln with that complexity. And would hope for AC. My Current $O(InsertSomeThingHere)$ (no I will not tell this to you) gives WA for last test case.

//Test Edit

(05 Aug '18, 19:02) aryanc4035★

@vijju123 @aryanc403 I am unable to edit my comment, if any of you can edit it (I think people with high reputation can edit other's comment) then do it, or else I will delete that comment

(05 Aug '18, 19:46) pshishod26454★

@pshishod2645, we can discuss this over codeforces message if this is ok to you.

(07 Aug '18, 00:57) likecs6★
showing 5 of 11 show all

In problem INMAT, I get this type of verdict of WA (-1.000000) and WA (0.000000) !! What does WA (-1.000000) mean ?


answered 07 Aug '18, 17:11

vivek_shah98's gravatar image

accept rate: 0%

Maybe it means that you're using more operations(K) than allowed.

(07 Aug '18, 17:42) mgch6★

@mgch, I am getting this type of verdict (refer link)!!

(07 Aug '18, 17:47) vivek_shah984★

A verdict of $-1$ time tells that the something which you did made interactor violate one of the assertions throwing a RE error. It means you are not adhereing to the constraints (eg- at most K queries).

(07 Aug '18, 18:25) vijju123 ♦♦5★

That is either because your output buffer is not clear or because you are making more operations(k) than allowed.

(07 Aug '18, 18:26) sagar_sam4★

I believe WA -1 does NOT refer to using more than K operations as in one of my submissions some of the cases of Subtask 2 gave WA 0.0 and some in Subtask 3 gave WA -1.0 . Initially I was into the same confusion that -1 means more than K ops and I believedmy code was logically wrong somewhere in Subtask 2. Hence in my code I asserted everytime an operation was made and as soon as it used more than K operations it threw an exception. Using this ALL the cases which resulted in WA previously(-1 and 0) in Subtask 2 and Subtask 3 gave RTE. I suggest you do the same to verify yourself.

(13 Aug '18, 08:09) jagreetdg3★

the cordinate compression qs is quite unclear. what does it mean by the subsequence amax(1,i-k).....amin(N,i+k)


answered 07 Aug '18, 21:34

sulekhiya's gravatar image

accept rate: 0%

@jagreetdg As, far as I know, you are not allowed to answer any query related to the problem statement, even if it's a clarification of problem statement. Otherwise I could have replied to it the day it was asked. someone please correct me if I am wrong(I don't know rules properly)...

(09 Aug '18, 23:29) pshishod26454★

@pshishod2645 - Yes, you're right. I deleted that comment now. @all please note that, posting your clarification requests is here primarily for contest admin @mgch to see in case the setter is not looking (so @mgch can contact the setter and get things right.) Other things may include addressing any serious complaints you got against anything during contests &etc. (You might be asked to discuss it elaborately over a private channel depending on if its fair to make it public).

(09 Aug '18, 23:35) vijju123 ♦♦5★

As the setter, I would also like to clarify that I intentionally publish all comments so that others are aware of what doubts are being asked and expect them to atleast see the comments before asking their doubts as it is very annoying to write the same reply everytime and if I try to not reply, people rant everywhere that there doubt was not clear. So, I expect people here to also understand that they should also keep on looking at comments if something is not clear and ask a question which has not been asked before, I would be happy to clarify your doubts.

(10 Aug '18, 00:48) likecs6★

Also, please don't hints regarding solution or more test cases.

(10 Aug '18, 00:49) likecs6★

I feel that I'm making mistake in flushing the buffer in INTERACTIVE MATRIX I'm doing it this way.

printf("1 %d %d", i, j);



is it the right way or I am doing something wrong


answered 10 Aug '18, 12:09

pshishod2645's gravatar image

accept rate: 13%


Yes, I believe it is correct. Just be careful I see you do not have "\n" in printf. I think it is needed.

(11 Aug '18, 04:07) allllekssssa5★

Is tc 31 something special in Interactive matrix question?

I got all correct except the tc 31... Can it be fault in mu algo or is it just some edge case? Please help all are correct except tc 31


answered 13 Aug '18, 12:22

shubham931's gravatar image

accept rate: 0%


i am stuck on coordinate compression. passed all the given test cases expect last sub task (last test case-9).it's very painful. i couldn't find anything wrong in my code. checked so many test cases. but nothing happened. can anyone help me with it. :'( :'(


answered 10 Aug '18, 05:00

rayhan50001's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 02 Aug '18, 20:09

question was seen: 2,163 times

last updated: 13 Aug '18, 18:27