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

Автор udoy07, история, 12 месяцев назад, По-английски

problem link:https://codeforces.net/contest/1352/problem/E

sol link with vctor :https://codeforces.net/contest/1352/submission/214450956

sol link with map :https://codeforces.net/contest/1352/submission/214450292

your valuable opinion will surely help others who's are like me. and if does not make any sense than please comment section is available, i will delete it.

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

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

While using vector your time complexity is approximately : O((n^2).1) = O(n^2) , and in case of map it is: O((n^2).log(n)) (since accessing time in map is O(log(n))) . N is given max 8000, so for vector TC: 6.4 X 1e7 and in case of map its 8.3 X 1e8, so solution using the map is bound to give TLE here.

  • »
    »
    12 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    exactly, being a newbie i didnt think for a sec, then i realize how it leads me to tle, for further solving any problem i will keep it in my mind, thanks for the calculated explanation.