nine.nine's blog

By nine.nine, 4 years ago, In English

In one of the recent problems (Link), I got the right (expected) output in VS Code compiler but WA on cf (Link). I think this is due to comparing the long double values. I even tried using

(cur - check > 1e-15) and (fabs(cur - check) > 1e-15)

instead of

cur > check

but still did not work. Can someone please help? Thanks in advance.

Full text and comments »

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

By nine.nine, history, 4 years ago, In English

If I use unordered_map<int,multiset> to store the values, it gives a TLE. In the same code, if I change it to unordered_map<int,vector>, and sort the map's value when taken into use (to act like multiset), doesn't give a TLE. How/Where is the time complexity different for both ?

P.S. — Pardon me if I did not follow the conventions of a blog, this being the first one. Would be happy to know about my mistakes.

Full text and comments »

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