Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

mdtareque's blog

By mdtareque, history, 8 years ago, In English

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

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
8 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

Try to submit using PyPy2.

Also, you can store the "strings" as bitmasks, so you can use a list of size 2^18 instead of a dictionary.