BOJACK - Editorial

Wow, beautiful! :neutral_face:

1 Like

:frowning:

6 Likes

@rajarshi_basu

but what the heck is this SOLUTION
Can u pls explain

5 Likes

I still didn’t get how those values came?

3 Likes

I’m sad.

2 Likes

same feeling bro :frowning:

1 Like

:sob:

KIng of adhoc problems.
Whenever humanity will talk about adhoc problems this problem will be remembered.

43 Likes

He has created string of type
aaaabbbbbccccdddd where repetitions of each of ‘a’,‘b’,‘c’ and ‘d’ are calculated to fit the conditions.

can anyone explain the formula,

the logic, why is it so?

6 Likes

My solution CodeChef: Practical coding for everyone gave wa during the contest, but the same passed later CodeChef: Practical coding for everyone
what happened?

I also checked my program for all possible values of d, it seems to be correct.

1 Like

They are identical

Checker has a problem.

This question is as adhoc as it gets. Some people are gonna have a hard time digesting this(me included). I was trying some stuff using triangular numbers and having strings like “abcd…z”. I had a feeling the actual solution was much simpler. Kudos to the author.

5 Likes

Appeal to change the contest name to AdHoc CC Contest ;-;

10 Likes

During Contest, All I believe was this is a dp problem and I was finding some O(nlogn) solution. After this editorial, I am like :astonished:

8 Likes

Umm, I just tried this, but it gave me a WA, I think there’s something wrong with the checker.
Here is the submission

EDIT: Darn it, we had to output the string length as well, I Iiterally worked on this problem for 2 hours, and didn’t notice that we had to output the length as well, sorry folks my bad. :sweat_smile:

4 Likes

should i laugh or cry after seeing this solution cant judge please help!!

3 Likes

And 7*n is provided Just to distract us! (My all thinking starts from number 7, I make different combination of a string having the length multiple of 7) :no_mouth: :no_mouth: :no_mouth:

7 Likes

From aaaa....bbbbb You can choose 0-D occurrence of each character.
So number of distinct Substrings is (D+1)(D+1) - 1.
-1 is because of the empty string.

Number of Palindromes in aaa...a is n\choose2 +n.

2 Likes