unt311's blog

By unt311, history, 3 years ago, In English

For this div3 problem (D),

I precalculate prefix frequencies of characters (editorial code does not), and I'm still getting TLE

My solve function's parameters are - 1. int c (character 0 is 'a', 25 is 'z') 2. int i (starting point of substring in consideration) 3. int j (length of the substring in consideration) [ using (1<<j) ]

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

| Write comment?
»
3 years ago, # |
  Vote: I like it +16 Vote: I do not like it

You are memset-ing the entire cnt array for each test case, regardless of the size of n.

»
3 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Memset. A silent killer.