-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best Subsequence Editorial #5183
base: master
Are you sure you want to change the base?
Best Subsequence Editorial #5183
Conversation
for more information, see https://pre-commit.ci
solutions/orphaned/usaco-1498.mdx
Outdated
It's always optimal to take the smallest suffix of $[l, r]$ that | ||
has $K - X$ zeros. To intuitively understand this, consider the fact that | ||
we want to maximize the first position where we have a zero in our subsequence. Given that we need to take at least $K-X$ zeros, we at a | ||
minimum should take the last $K-X$ zeros in our range. Because we are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are other ways to maximize the first zero position that don't take all of the last
solutions/orphaned/usaco-1498.mdx
Outdated
|
||
## Implementation | ||
|
||
**Time Complexity:** $\mathcal{O}(Q\log^2N)$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+M(\log M + \log N) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some minor changes above
|
||
const int range_len = vals.size(); | ||
vector<int> diff(range_len); | ||
for (const auto &[l, r] : upds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think reference is required here
Add some comments to the code. |
u might want to add this to a module so ppl acc read this |
what module would you recommend? im thinking hashing or additional practice (gold) would be suitable |
Hashing is better |
Co-authored-by: Benjamin Qi <bqi343@gmail.com>
for more information, see https://pre-commit.ci
coord compression or modular arith |
Place an "x" in the corresponding checkbox if it is done or does not apply to this pull request.
ok hopefully adding this to monthlies works