Code forces round710 div3 problem Epic Transformation

Problem link: Problem - D - Codeforces
My solution: Submission #111101468 - Codeforces
Can anyone tell me how do I optimize my solution? I trying to upsolve the problem and I came across the editorial which used priority queue and I found it to be useful but why am I getting TLE when both look similar?
Editorial:Codeforces Round #710 (Div. 3) Editorial - Codeforces

AC! The problem was that I was using unoredered_map for counting the frequency of array elements but when I replaced unordered_map to just map it gave AC :thinking: :roll_eyes: :no_mouth:

Read it

1 Like