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

Правка en2, от 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://codeforces.com/contest/714/problem/C

Теги python 2, div2c

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский mdtareque 2016-09-13 22:57:38 17
en1 Английский mdtareque 2016-09-13 22:56:59 598 Initial revision (published)