Hi all,
I am trying to upsolve this problem. https://mirror.codeforces.com/contest/1699/problem/E
Can someone please help me understand the first two paragraphs of the editorial ?
How to build the DP solution that is mentioned in the paragraph-2 ?
How to do it in O ( vmax * log vmax * log vmax ) ?
Thanks in advance.
I think the solution in the editorial is overkill. My solution:
|=
$$$f(k)$$$ for all $$$k$$$ from $$$1$$$ to $$$m/(j+1)$$$ (similar to adding $$$j+1$$$ to a knapsack with product instead of sum).The complexity is $$$O(n + m \log m)$$$, because each $$$i$$$ is added and removed from the knapsack at most once.
Thank you for the response :D .
Sorry for asking again, but what does
|=
signify ?a |= b
is the same asa = a|b
where|
is the bit or operatorok. thanks.