Блог пользователя Fume

Автор Fume, история, 5 недель назад, По-английски

I am trying to reduce the calls to access map elements so used varaibles by reference but got runtime error. Can anyone help. Runs correctly on local machine.

https://codeforces.com/contest/1974/submission/262484871

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
5 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

how will this even reduce the number of calls it still takes O(N) time

»
5 недель назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

You do not need references but if you want to, then you have to maintain their validness (learn about rebalancing of maps). Also you should not try to deallocate memory that maps alloced internally (this leads to the runtime errors I think).