Subprnjl - editorial

And btw I hope u know that all problems gets 100 points regardless of difficulty and it’s only setter who gets different amount of payment on basis of difficulty… I don’t see any point that u should have any problem… And the O(n^3) soln passes which shows it’s an easy problem

It can be solved by simple sum query Segment tree also and if you don’t even know segment tree then I don’t think you are a competitive programmer yet… It’s very popular tree… You should learn it by now then… And even if u don’t know it… It’s still solvable without it…

Chef and soccer has 1/8 times submission than this problem and it was categorised as easy medium… So what difficulty do you expect for this one ? Same ? Or medium ?

Well I know about segment tree. But for this problem I solved using BIT but after the contest though.
https://www.codechef.com/viewsolution/23587323

One thing I can agree since the constraint is weak it can be solved without any tree. But editorial does not say about it clearly.

I am getting tle for my solution.
https://www.codechef.com/viewsolution/23590284

what is the use of TREEOFFSET there in the tester solution? will anyone, please explain to me. thanks in advance

someone, please give the links of the resources of

  1. finding kth smallest element in an array for a range
  2. frequency find in a range

I applied the last approach of Heap using priority queue. Can anyone tell me where I was going wrong?
https://www.codechef.com/viewsolution/23482405

Okay :slight_smile: @prmondal
That’s great…

I got WA when used

m = ceil((float(k)/float(r-l+1));

but got AC when used

m = k/(r-l+1) + k%(r-l+1)==0?0:1;

Can somebody tell me the difference between the two?

My submission using both:

https://www.codechef.com/viewsolution/23444985 - using ceiling function
https://www.codechef.com/viewsolution/23444732 - using ternary operator

I maintained an array throughout the problem and used insertion sort and tweaked a bit of binary search to find the position to insert an element. once array is sorted, everything will be easy.
Got an AC :wink: hahah
Have a look here solution

Why am I unable to add a comment to other users’ answers?