Mridul323's blog

By Mridul323, history, 2 months ago, In English

Hello Codeforces!

Recently I was trying to solve problem 1102E - Monotonic Renumeration

I tried submitting my solution 100299607 using unordered_map and got TLE on test 47. Then I went thorough the other solutions and found that people have solved it using map. I submitted same code again 100299556 using map and this got Accepted.

I used to think that unordered_map is always faster than the map. I googled and then get to know that search time of map is O(log(n)) while search time of unordered_map in O(1) and in worst case its O(n).

Internally unordered_map is implemented using Hash Table so how the search time can take O(n) in worst case?

Somebody please clear my doubt.

Thanks

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

By Mridul323, history, 3 months ago, In English

Hello Codeforces,

Today I was trying to solve 1443C - The Delivery Dilemma from recent contest. In one of my solutions I used accumulate to find sum of all the elements in a vector but my solution failed on test case 4 then I tried general way of finding sum of all the elements and surprisingly this got accepted. To be honest I just couldn't figure out what was wrong in my previous solution. I tried searching internet but I could not find any drawback of accumulate so far.

Submission with Accumulate : 97509394 Submission without Accumulate : 97509418

I am really confused what could go wrong. Somebody please let me know if there is some mistake in my former submission and in which cases we should not use accumulate. Thanks in advance :)

Read more »

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

By Mridul323, history, 5 months ago, In English

Hello Everyone! Recently code_warrior asked in one of his blogs " How is ecnerwala ?" and surprisingly ecnerwala came up with a new blog where he answered about himself and that blog is flooded with questions, it just shows how curious we guys are to know him closely.

I just want to take this trend a little forward, so I am tagging my favorites while wishing that they come up with something similar to ecnerwala . They are superstars of our community and there are always many things that we could learn from them and their journey.

Errichto

Um_nik

SecondThread

Radewoosh

Benq

And the Indians, I really look up to

Ashishgup

striver_79

kal013

I also wanted to tag MikeMirzayanov, but I am not sure if he could take time from his busy schedule. Btw the above guys are my favorites I want to know more about. And I am quite sure others like me must have many questions to ask them. If you want me to add more, please mention it in the comments.

I really wish that they come up with "Hey I am ....", Ask my anything.
Thank You <3

Read more »

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