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

Автор MuhammadSawalhy, 13 месяцев назад, По-английски

In the recent Div 3, I was rushing to submit fast to reduce the penalty so I miss-typed this part of the code:

            if (j + tochange[i])
                dp[i + 1][j + tochange[i]] = dp[i + 1][j + tochange[i]] | dp[i][j];

It should be:

            if (j + tochange[i] <= n)
                dp[i + 1][j + tochange[i]] = dp[i + 1][j + tochange[i]] | dp[i][j];

Can you hack my submission, please?: 203309510

Update:

Solution verdict: Wrong answer

Congratulations Yousef-Elwan!

But why my solution didn't get RTE?

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

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

It seems I'm the only person who solved it like this (with DP). So, now I'm unsure about my idea and don't have firm proof.

You can go ahead and try hacking with wrong answers as well.

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

Could you explain your idea,please?

  • »
    »
    13 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I need to choose some letters that are the same on both sides with other letters that are the same as well so we fix two in just one operation (greedily).

    So I need to choose some of these letters that their count is the closest to (total / 2).

    Example:

    1
    8
    abcaadba
    

    We notice that the letters the need to be fixed are:

    ab aa ba
    

    After one operation:

    aa ba ba
    a      a
    

    That last one can be fixed in one operation.

    You can solve this DP problem first to understand the idea: https://cses.fi/problemset/task/1093.

    The flaw here is that, I either take all of "a" for example and swap them with others or leave them all.

»
13 месяцев назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

Wow you're the guy from fegla senior training

»
13 месяцев назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

I think it's a wrong idea, not only that it crossed n