Invitation to Coders' Legacy 2020 (Rated for all)

Hoping the same

While submitting solution for 3rd problem, there was some server issue so i had to retry 2 times. Now its showing I made 3 correct Ac submission for 3rd. All submissions are identical. Did I get any penalty for that? If yes, Can anything be done about it?

No, you’ll not get a penalty for AC submissions.

2 Likes

You could have checked in “My submissions” to make sure if you’ve submitted or not.

1 Like

Nice problems! Waiting for the editorials

Questions were really awesome…Loved solving them :smile:

1 Like

Amazing set of questions, really enjoyed it. :v:

2 Likes

How to solve 4th (CLLEXO) ?

Can someone suggest how to solve the 4th problem. I did try using DP but that was giving TLE as I was comparing the strings in O(N+M-1) and my DP was (NM) so total time complexity becomes O((NM)*(N+M-1)). Is there some algorithm involved in this comparison that I might be unaware of?

I will be more than thankful to anyone who will tell the mistake in my solution for the 4th question. There is mp a silly mistake somewhere but I am just not able to figure that out.

Thanks in advance :slight_smile:

Can you explain your approach to this problem please? I think it will be really helpful for all of us.

Why did constraints have to be so high in… every problem? I had to struggle very hard to squeeze CLUNQUE. And anyone who doesn’t use C++ would be totally screwed.

6 Likes

Actually the prompt said it was not uploaded, so I assumed its not submitted. My bad.

It’s a WA, I will explain though
Following observations-

  1. The question is basically this- find lexicographically smallest string going from (0,0) to (n-1,m-1) by only moving right or down but we can - not go in a cell marked #.
  2. The answer string will be of length n+m-1

I did a DFS from (0,0). For both it’s children, I am checking if they are valid ( They are not # and there is a path from them to (n-1,m-1)). Now assume they are valid. The current character will come at the position row+col (if it will come) in the answer. So I am marking that For (current level,char) the next char should be the min of chars of it’s valid children.

After this just following the path from (0,0) to get the answer.

indeed constraints were a pain.

Complexity of both of my last 2 submissions of third problem (CLBRKT) were O(qlog(|s|)). The only difference between two submissions was a cin and scanf only for the input of number of test cases T.

The one with cin got TLE Submission
Other one with scanf got AC Submission

I am not sure why this happened and it costed me 1 hour of penalty time.

I haven’t looked too hard at your code. But from your logic, I see what looks like a mistake. How do you break ties?

Please ignore this, I’m high

2 Likes

Expected was O(|s|+Q) I guess , so you are lucky that it got passed.

Maybe, I spent last hour trying to figure out O(|S| + Q) solution, but fortunately got accepted :smiley:

1 Like

Why couldn’t PyPy2 pass even problem 1?