WEIRD2 - EDITORIAL

@admin has 0 rating afaik. How much will you drop it now XD

1 Like

@taran_1407
tarini seems to be annoying you XD

1 Like

Lol @l_returns . Who knows, he might be actually enjoying it deep down?

1 Like

Lol, Who will catch setter’s solution? :stuck_out_tongue:

true… agree 100%

1 Like

What the hell!!

I solved it using Merge Sort Tree. Here’s my solution : CodeChef: Practical coding for everyone
Fun Fact : In the init function, if you clear the whole arrays(size N), you will get TLE :stuck_out_tongue:

1 Like

May u suggest any test case

all setter’s soln are matching with mine… setters are going to get plagiarized lol…

color grid also matches with minor changes…

Correction: You are going to be plagiarized. xD

cc the mail to me then XD

…XD

agree with @aryanc403
both should be plagiarized

It will depend upon the internal implementation of the unordered map. Maybe make a random test case generator and match output with Accepted solutions.

What’s your logic precisely?

Actually @tarini_1407 haven’t made any attempts on any questions. It just posts to annoy @taran_1407 xP

1 Like

For (a, b) to contribute to the answer, freq[a] >= b && freq[b] >= a. Thus, if we for some number(say num), we know the freq[num], candidates for b are 1, 2, 3, … num. Which ones will actually be considered? The ones whose frequency is > num.
So, build merge sort tree on frequency array. Iterate through all the numbers, say freq of current number is curr. Check how many numbers have frequency > curr by querying the merge sort tree in range 1 to curr.
I hope it is clear!

Oof I did the exact opposite. My underlying array for the merge sort tree was the numbers 1 to 1e6 instead of the frequency values :frowning:

Thanks for explaining your way

I actually solved this in java. In Java, there is no such way where we can get the number of elements smaller than x. We have the function floor, which returns the element less than or equal to x. So, Order statistic tree is a must, at least for java users.