prthydv5's blog

By prthydv5, history, 4 years ago, In English

I tried to solve the problem TRPLSRT of codechef may 2020 long challenge div 2. I tried to solve it in 3 passes. In pass 1 i selected the triplets which after performing operation on all 3 will make all 3 go at their correct positions. Then i performed operations on such triplets. In pass 2 i selected the triplets which after performing operation on all 3 will make atleast 2 go at their correct positions. Before doing pass 3 i made a new array(ones[]) which would consist of indices of elements whose values are each other’s indices. Ex — a[1] = 6 and a[6] = 1. In this new array indices will be stored in increasing order for every pair of such numbers. So for above example their indices will be stored like 1, 6. In pass 3 I take every 3 consecutive indices from this new array and perform operation on the elements at these indices such that i1 is the third number, i2 is the second number and i3 is the first number of these 3 consecutive indices from left. I implemented it but I am getting WA. I don’t know if I have not correctly implemented this logic or there is a better logic which sorts in fewer number of operations. I have attached images of my code.

Full text and comments »

  • Vote: I like it
  • -26
  • Vote: I do not like it

By prthydv5, history, 4 years ago, In English

What is better for a beginner: doing first 100 problems on SPOJ according to number of users or doing first 100 problems on codeforces according to difficulty?

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

By prthydv5, history, 4 years ago, In English

I am a 2nd year student and I have managed to get 5 stars in Problem Solving part of Hackerrank. Also i have done around 10 practice problems on codechef nothing else. What should I do next to improve in competitive programming?

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

By prthydv5, history, 4 years ago, In English

How should I approach competitive programming? Should I first learn the necessary algorithms and data structures and then start solving questions or should I try to solve the problem with basic mathematical knowledge and when I cannot do that then I learn the necessary algorithm?

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

By prthydv5, history, 5 years ago, In English

Is there a way by which I can sort someone else's submissions according to date of submission?

Full text and comments »

  • Vote: I like it
  • -4
  • Vote: I do not like it