Скоро Codeforces Round 1133 (Div. 1, Div. 2)! Регистрация здесь. ×

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

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

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.me/contest/1974/submission/262484871

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

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

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

»
2 года назад, скрыть # |
 
Проголосовать: нравится +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).