ANKPAREN - Editorial

The links to the solutions do not work [ Access Denied ]. :frowning:

1 Like

My solution failed due to bad input, maybe you have the same problem: ANKPAREN - Editorial - #3 by luc4sdreyer - general - CodeChef Discuss

1 Like

I had a similar same problem, but I only realized it after the competition :frowning:

I wonder if the mods will consider rejudging this problem.

Hi luc4sdreyer,

We are investigating the issue. If such a issue is there, we will rejudge the problem.

1 Like

I’m not getting the lexicographic order you’ve mentioned.

I am not the setter of the problem. :stuck_out_tongue: I’ll ask Ankit to reply.

1 Like

Even i had same problem

Hi, I am glad you found the problem interesting.
However, the story behind this problem is not so interesting :P.

I proposed a version of this for cakewalk where you had to find only the lexicographically smallest. However, it seemed a little harder than a 1st problem should be yet, easier than 2nd problem :stuck_out_tongue:
So, I just modified it to ask for kth subsequence and tried to solve it myself. Needless to say, I was equally amazed upon finding such a beautiful pattern :smiley:

1 Like

That’s because adding strings is not the same thing as adding integers!

In line 59, you have a string final with 0 length. Then you reach line 63, where it has length n - 1. Notice that string concatenation takes time: O(number_of_characters_added). So, you have are doing n - 1 operations inside a loop that runs atleast n times. Thus, you have quadratic complexity and get TLE.