Vika and Price Tags TLE on test 21. (Help required)

Revision en1, by KIMJONGOOF, 2024-08-31 11:49:42

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://mirror.codeforces.com/contest/1848/problem/C

Submission Link -> https://mirror.codeforces.com/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!!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English KIMJONGOOF 2024-08-31 11:49:42 483 Initial revision (published)