Блог пользователя BanazadehAria

Автор BanazadehAria, история, 5 лет назад, По-английски

Hi, I have written a simple dp solution for this problem ==> https://codeforces.com/contest/383/problem/D.

But its something strange that it gets accepted without memory optimizes ==> https://codeforces.com/contest/383/submission/68460051

and it doesnt get accepted with memory optimize ( Every state gets update only from before (i-1) So we can only have 2 rows). https://codeforces.com/contest/383/submission/68460038

The only thing that different is in these two solutions is simple memory optimizing.

UPD: solved

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Firstly u still have dp array with size 1001 * 20005 (ur optimization in ur code is useless).
Secondly, if u just need to clear ur array before using it (u have the rubbish in ur array when using it)
I submit ur code just adding two lines, check https://codeforces.com/contest/383/submission/68626410

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by BanazadehAria (previous revision, new revision, compare).