Skip to content
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

CSES Subarray Sums II - Wrong Time Complexity #5016

Merged
merged 7 commits into from
Jan 8, 2025
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions solutions/silver/cses-1661.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ the map.
<LanguageSection>
<CPPSection>

In C++, because `std::unordered_map` has a bad constant factor,
SansPapyrus683 marked this conversation as resolved.
Show resolved Hide resolved
we use `std::map` at the cost of adding an extra log factor to the complexity.

```cpp
#include <iostream>
#include <map>
Expand Down Expand Up @@ -110,6 +113,12 @@ public class SubarraySumsII {
</JavaSection>
<PySection>

<Warning>

The below solution TLEs due to Python's constant factor.
bqi343 marked this conversation as resolved.
Show resolved Hide resolved

</Warning>

```py
def main():
N, X = map(int, input().split())
Expand Down