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

Автор kingofnumbers, 11 лет назад, По-английски

I need help to solved this intersting problem link .

thank you in advance.

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

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

if you now know how to solve it then please help .

  • »
    »
    6 лет назад, # ^ |
    Rev. 4   Проголосовать: нравится -8 Проголосовать: не нравится

    not sure at all but this might work:

    First, let's work on finding the # of cool numbers <= X, for a given X (then we can get the answer by computing that for B and A-1).

    For a fixed X, we can get the # of cool numbers with a dp[digit][sum1][sum2][alreadyless_bit]

    digit will be the position of the digit we're trying, We will go from most significative to least. sum1 and sum2 are the sums of the two sets. alreadyless_bit tells if we are already strictly less than X, if so, the new digit can be any digit, otherwise, it has to be between 0 and the respective X's digit.

    This counts the cool numbers but it might count each one many times, I don't know if you can avoid that hehe

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

Did you solve this problem later.. ? If yes can you share your idea?

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

Can someone help in this question

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

I might be wrong, but how about...

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

    I couldn't think of any solution. I know above idea proposed by lmn0x4F seems to be good but couldn't find a way to for overcounting issue.

    Can you provide some hint?

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

      I viciously precomputed answers for blocks of size 200000 and then solved naively for the remainders. You might want to have a fast naive solver (i.e., $$$O(d)$$$ instead of $$$O(d^2)$$$ knapsack). Keep in mind the 50K source size limit.