Help me understand why this python sol to Div2 C gave TLE

Revision en2, by mdtareque, 2016-09-13 22:57:38

I would be grateful, if anyone could

  • point out why the below solution TLEd?

  • give hints to improve the code running time?

Logic explanation in plain english:

  • Create a dictionary of string, int.

  • the key stores the patterns of len 19 for each number w.r.t to parity of each digit e.g ( 00000000101010111011 )

  • the count of pattern is incremented, decremented accordingly.

  • Ans is just a dictionary lookup for given pattern

20594344

Contest 371 DIV2 Problem C : http://mirror.codeforces.com/contest/714/problem/C

Tags python 2, div2c

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English mdtareque 2016-09-13 22:57:38 17
en1 English mdtareque 2016-09-13 22:56:59 598 Initial revision (published)