Invitation to CodeChef LTIME60

Hello CodeChef Community!
We’re happy to announce the 60th edition of your beloved three-hour coding jam. Yes, it’s time for LTIME60 for the month of May. Looking forward to having you join in the fun! Joining me this time on the problem setting panel are:

  • Problem Setter: kingofnumbers (Hasan Jaddouh), ratingoverflow (Tianyi Qiu)
  • Problem Tester and Verifier: xellos0 (Jakub Safin)
  • Problem Editorialist: vijju123(Abhishek Pandey)
  • Russian Translator: xcwgf666 (Sergey Kulik)
  • Mandarin Translator: huzecong (Hu Zecong)
  • Vietnamese Translator: VNOI Team

Contest Details:

Time: 26th May 2018 (1930 hrs - 2230 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.

Top 10 performers in Global and Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: (For those who have not yet received their previous winning, please send an email to
Good Luck! Hope to see you at the contest!


@vijju123 u are editorialist this time :slight_smile:
Glad to know :slight_smile:

Hello all,

Hopefully you guys enjoyed the contest. We tried to answer as many relevant comments as possible. If yours was not answered, or answered late, please try to read problem statement carefully next time.

The editorials for all 6 problems are posted at discuss, so that you guys can read, debate and share approaches for the problems.

One request I have from community as a whole is, these 6 editorials had to be written quickly (in a span of 2 days) and hence, were written in a little haste. There can be some silly errors like spelling mistakes, incorrect link to problem etc. Hence, I’d request the community to point out any such mistake, ask clarifications for any unclear part &etc. so that we can further enhance the editorials.

Also, I did not get much time to analyze a lot of solutions during contest to write in editorials, so any alternate approach other than editorial is very much welcome. I will update bonus corner with any relevant material I find.

Editorialist’s code will be put on demand, and I will try to ask setter and tester to comment their codes nicely, before @admin links them.

Finally, for sake of immediate access, setter and tester’s codes are copied in editorials (will be visible when you click the “Show” button beneath the respective categories). You can copy the solutions and paste them at any place you are comfortable reading.

Thats it from my side,
Thanks and Regards


I think the tests for the problem TSUM2 for the second subtask is not correct. My code, which I expected gets partial score, gets verdict WA, after that I added the check in code, that the diameter in the given tree is no more than 200, like it’s said, but it gets verdict RE on the two out of 4 testcases in the second subtask.

Code with commented check(assert(good())):


Code with not commented check(assert(good())):



Thanks for your contribution, I am a newbie and I am very eager to see the most difficult two questions’s editorials in this contest。

Unfortunately, there were misconfiguration in test-cases of TSUM2 which resulted in some test-cases going to wrong subtasks, we have fixed it and rejudged all solution, it has affected about 5 people, those who were trying full task from the beginning weren’t affected by the issue.


@vijju123 when will we get the editorials for the last two questions of LOC May 2018 ?

@vijju23 @admnin
The maximum rating increase for a user is 100+75/(no of contest) + 50000*(ratings-1000).
So for a user hit by plagiarism hammer, it’s gonna take two much time for get ratings to their original level, even if i scored very good rank (like only 150+ even though I’m in rank 50 of Div1 right now).
Please increase the max rating bar…

Thank you for that dear! Working hard for editorials. It was like, 5 editorials to be done in 2 days - which is a stressful/tough deadline to meet xD. Working hard for the editorials. They might seem as if written in haste (due to spelling mistakes etc.) but those all will be corrected in due time, once they are posted and I finish the set :slight_smile:

1 Like

thanks… :slight_smile:
that’s not an issue…

Hoping after contest is over. Servers will be able to handle load. And there will be no need of constant refresh.xD

Yup. And hopefully @admin will transfer the editorials today and not tomorrow. Give this contest in best spirits. :slight_smile:


Reminder- Just 16 minutes to contest!!

@vijju123 can u plz provide editorial to problem Molecular mass:-


plz ill be very gratefull for that.

Writing editorial will be expensive. I can resolve your doubt if you want :slight_smile:

Shouldn;t had been the case. Let me redirect the tester here. The tester did checked the problem statement a little before beginning of the contest for this particular thing itself

can u solve it in pseudo code.(step wise).

Im basically stuck at keeping track of ‘(’ brackets while pushing in stack.

so when a digit comes it must be multiplied with entire formulae or preceding group only.

for eg :-

(choh)2(ho)4 // here 4 to be multiplied only with ho

((choh)2(ho)3)4 // here 4 with entire formulae

how to keep distinguish bcause for both case stack gets empty on reaching last digit

It seems like I’m not the only one, who faced with this:

I have mailed your concern to the contest admin, the setter and the tester. Thank you for reaching out!

They are already out!