TRPLSRT - Editorial

Hi, In my opinion to excel in competitive programming you need to take one step at a time. Just list the topics that you need to work on eg.

  1. Arrays
  2. Dynamic programming
  3. Recursion
  4. Linked List

Then, start working on single topics at a time. When you cover all the topics then, start picking questions from any random topic and think to you apply the concepts that you have already studied. And this will boost your confidence. When you have all the tools in your bag-pack then, only your are able to solve any problem. Suppose you have study Recursion and Greedy algorithms topic very well. But I have given you the problem of dynamic programming then, you won’t able to solve it right ? So, when you have knowledge of every concept of CP then, you are able to solve any problem or start approaching a given problem with correct mind set.

3 Likes

yes that would be very helpful if they consider _/_

1 Like

Thanks brother…appreciate that.

I got WA only on last case.
please tell where I was wrong.
here is my code.
https://www.codechef.com/viewsolution/33000223

Hey Shubham! Thanks for sharing this idea! I had used the same idea in the contest but was unfortunately getting wrong answer for the last test case. Can you please help me with my solution.

https://www.codechef.com/viewsolution/32867171

https://www.codechef.com/viewsolution/33058642
Can someone help me pleaseeeee.

Can somebody please tell why i am not getting even last 3 tc correct. Please provide any tc that my code produces wrong output.

here is my submission link.
https://www.codechef.com/viewsolution/33061031

1 Like

Same issue.

Triple Sort (TRPLSRT) - CodeChef May Challenge 2020 Solution - YouTube watch this i found it short and concise.

2 Likes

I absolutely loved this approach, thanks for sharing!

I am getting 3 WA in subtask3.
someone, please tell me where I am going wrong.

approach:

traversing from start
skip the index where value is correct.
else rotate the triplets (selection of triplet indexes is explained below)
In the end, If I find a pair (cycle of 2), and the rest of the elements are on their correct place then it is not possible to sort the array.

selection of triplets in the following way.
i1 i2 i3
i1 is the current index where value is on incorrect position
i3 is the index where that value is present which should be at i1.
i2 is the index where that value is present which should be at i3.

In the case of the cycle of 2.
I select i2 the next index where value is incorrect.

https://www.codechef.com/viewsolution/32937292

1 Like

can you explain why we are checking this condition here?

Hii, I have done this ques simply by using Array . To complete it with ease check here
CodeChef: Practical coding for everyone.

thanks for sharing :slight_smile:

        if(i1 > j1){
            swap(i1,j1);
        }
        if(i2 > j2){
            swap(i2,j2);
```I don't understand this step in setters solution.
Can anybody help me?

Video Explaination which is much simpler and better explained with examples and pre-req for the problem

What is the meaning of “the permuation is odd”?

@losmi247
I M getting WA in just 1 test case plsss help why
https://www.codechef.com/viewsolution/33363905

@dcoderpikachu
I M getting WA in just 1 test case plsss help why
https://www.codechef.com/viewsolution/33363905

The editorial could have been better, if it had short examples for all the proofs ! Otherwise, it’s harder to relate to !