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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dgeosh
Copy link

@dgeosh dgeosh commented Dec 30, 2024

https://usaco.guide/problems/cses-1661-subarray-sums-ii/solution
STL ordered map data structure used for implementation with N accesses.
Each access takes logn.
Time complexity should be O(N log N), is incorrectly denoted O(N).

Place an "x" in the corresponding checkbox if it is done or does not apply to this pull request.

  • I have tested my code.
  • I have added my solution according to the steps here.
  • I have followed the code conventions mentioned here.
    • I understand that if it is clear that I have not attempted to follow these conventions, my PR will be closed.
    • If changes are requested, I will re-request a review after addressing them.
  • I have linked this PR to any issues that it closes.

@SansPapyrus683
Copy link
Contributor

i mean you could replace it with unordered map but that literally makes it slower
also java/python uses a normal hashmap impl

@envyaims
Copy link
Member

i mean you could replace it with unordered map but that literally makes it slower also java/python uses a normal hashmap impl

maybe just add a note the log factor is caused by hashmap

@bqi343
Copy link
Member

bqi343 commented Jan 1, 2025

maybe just add a note the log factor is caused by hashmap

huh? hashmap doesn't have a log factor

btw, the Python solution now TLEs on CSES due to hacks 😆

@SansPapyrus683
Copy link
Contributor

unlucky, we should prob add a warning for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants