Please read the new rule regarding the restriction on the use of AI tools. It applies starting from round 972. ×

KIMJONGOOF's blog

By KIMJONGOOF, history, 2 weeks ago, In English

Hi!! As apparent from the Title, I am getting TLE on test 21 for the question and I have no idea how to optimize it.(I read the tutorial but could not understand)

Question Link -> https://codeforces.net/contest/1848/problem/C

Submission Link -> https://codeforces.net/contest/1848/submission/278910279

I am pretty sure that there has to be some way to optimize the ans() function in my code. Can anyone help??

Thanks!!

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