the problem is http://codeforces.com/contest/513/problem/C

the solution is http://codeforces.com/contest/513/submission/9761274

i wonder how this solution not TLE it is 1009*1009*6*6*6 which is TLE

Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official.
×

# | User | Rating |
---|---|---|

1 | Radewoosh | 3759 |

2 | orzdevinwang | 3697 |

3 | jiangly | 3662 |

4 | Benq | 3644 |

5 | -0.5 | 3545 |

6 | ecnerwala | 3505 |

7 | tourist | 3486 |

8 | inaFSTream | 3478 |

9 | maroonrk | 3454 |

10 | Rebelz | 3415 |

# | User | Contrib. |
---|---|---|

1 | adamant | 173 |

2 | awoo | 167 |

3 | SecondThread | 163 |

4 | BledDest | 162 |

4 | Um_nik | 162 |

6 | maroonrk | 161 |

6 | nor | 161 |

8 | -is-this-fft- | 150 |

9 | Geothermal | 146 |

10 | TheScrasse | 143 |

the problem is http://codeforces.com/contest/513/problem/C

the solution is http://codeforces.com/contest/513/submission/9761274

i wonder how this solution not TLE it is 1009*1009*6*6*6 which is TLE

↑

↓

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/01/2023 16:04:27 (k2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Dude. You don't just analyze the complexity by counting for loops

the each iteration in the for loop work as i clear the dp array so this is the complexity i am confused :s

For clearing the dp array, I see four for loops and they go till 6,6,6,10009 so how TLE?

no i mean the dp is in 10009*6*6*6 okay but there is for loop iterating on dp in the main so what is the total complexity ?

Memoization technique has been used in the solution, which means you just calculate the value for each state only once. Therefore the whole solution proceeds 10009*6*6*6 different states which is pretty far from TLE.