1 / 3
Jun 2011

Hi. Can anyone explain why it's TLE? It's O(n), since it just iterates through pairs and gets/sets values by key from dicts (which is O(1)), and checking for dict membership is also O(1). Or isn't it? Or even O(n) isn't enough here, using Python? Oh, I see that only one person managed to do it in Python, but I don't understand what can be slow in my code. smile

no need for code :-)
  • created

    Jun '11
  • last reply

    Jun '11
  • 2

    replies

  • 234

    views

  • 2

    users

Your code must be very(!) well optimized to get AC within the timelimit using Python because of large I/O.