SoleProprietor's blog

By SoleProprietor, history, 2 years ago, In English

I have two almost identical submissions getting a substantial difference in execution time:

TLE submission uses variable MOD inside the main function:

def main():
    MOD = 998244353  # local var
    ...
main()

and the AC submission uses variable MOD outside:

MOD = 998244353 # global var
def main():
    ...
main()

Any idea what causes such a difference in performance?

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it