I need help to solved this intersting problem link .
thank you in advance.
# | User | Rating |
---|---|---|
1 | tourist | 3856 |
2 | jiangly | 3747 |
3 | orzdevinwang | 3706 |
4 | jqdai0815 | 3682 |
5 | ksun48 | 3591 |
6 | gamegame | 3477 |
7 | Benq | 3468 |
8 | Radewoosh | 3462 |
9 | ecnerwala | 3451 |
10 | heuristica | 3431 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | -is-this-fft- | 162 |
3 | Dominater069 | 160 |
4 | Um_nik | 158 |
5 | atcoder_official | 157 |
6 | Qingyu | 156 |
7 | djm03178 | 152 |
7 | adamant | 152 |
9 | luogu_official | 151 |
10 | awoo | 147 |
I need help to solved this intersting problem link .
thank you in advance.
Name |
---|
if you now know how to solve it then please help .
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
Did you solve this problem later.. ? If yes can you share your idea?
Can someone help in this question
I might be wrong, but how about...
...submitting some "solutions" close to the source size limit? ;)
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?
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.
Thanks a lot for sharing your approach