MOOONI's blog

By MOOONI, history, 4 years ago, In English

Hi. Here's my solution for the latest div3 problem D : https://codeforces.com/contest/1385/submission/87172064

can somebody please help why it gets TLE? I checked my solutions with some accepted ones and the idea was the same.

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

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

Most likely trying to memset f every test case is causing the TLE. If there are 20,000 test cases and you set 200,000 * 26 ints each test you'll run out of time.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    but it's said that some of n does not exceed 2 * 10 ^ 5. did you notice?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    Sorry. I got what you said. Thanks in advance!