Wondering why I got TLE?

Правка en1, от Gaurav3478, 2022-05-07 23:01:37

For the recent contest (Codeforces Round #788 (Div. 2)), I was practicing submitting problem C after the contest. I got TLE on submitting the below code: https://codeforces.me/contest/1670/submission/156232289

However, after I changed the vectors to become global (as you can see in the submission below), the code got accepted: https://codeforces.me/contest/1670/submission/156232089

Can anyone explain why? I am guessing it is because of too much memory usage, but I am not sure and would appreciate any insights. Moreover, how can I know when to keep vectors global in the future?

Thank you!

Теги question, time limit exceeded

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Gaurav3478 2022-05-07 23:01:37 631 Initial revision (published)