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

Complete Incomplete Sections in General - Silver #3444

Open
1 of 3 tasks
bqi343 opened this issue Feb 18, 2023 · 6 comments
Open
1 of 3 tasks

Complete Incomplete Sections in General - Silver #3444

bqi343 opened this issue Feb 18, 2023 · 6 comments
Labels
content content-related issue good first issue Good for newcomers

Comments

@bqi343
Copy link
Member

bqi343 commented Feb 18, 2023

In all languages for General, Bronze, and Silver. It should be easy to spot what needs to be added after #3443 is merged.

  • C++: General - C++ w/ Command Line
  • Java: Silver - Binary Search
  • Python: General - Debugging, Bronze - Sorting & Sets, many Silver modules
@bqi343 bqi343 added content content-related issue good first issue Good for newcomers labels Feb 18, 2023
@bqi343 bqi343 changed the title Make Incomplete Sections Incomplete Complete Incomplete Sections Feb 19, 2023
@SansPapyrus683
Copy link
Contributor

i'm ctrl f-ing in the silver binsearch module and don't see any <IncompleteSection> headers?

@bqi343
Copy link
Member Author

bqi343 commented Mar 3, 2023

the last quiz question is only in C++

@bqi343 bqi343 changed the title Complete Incomplete Sections Complete Incomplete Sections in General - Silver Mar 7, 2023
@SansPapyrus683
Copy link
Contributor

image

what does this mean

@bqi343
Copy link
Member Author

bqi343 commented Dec 29, 2023

there are probably better command line tutorials than the ones in the module

@Varsshhh
Copy link

Varsshhh commented Jul 4, 2024

Python implementation for Greg and Array from Difference Arrays (More on Prefix Sums - Silver)

import itertools
n,m,k=map(int,input().split())
array=list(map(int,input().split()))
operations=[]
for _ in range(m):
    operations.append(list(map(int,input().split())))
queries=[]
for _ in range(k):
    queries.append(list(map(int,input().split())))

diff_oper=[0]*(m+2)
for x,y in queries:
    diff_oper[x]+=1
    diff_oper[y+1]-=1 
diff_oper=list(itertools.accumulate(diff_oper))

for i in range(1,m+1):
    operations[i-1][2]*=diff_oper[i]  # l,r,d to l,r,chunk
    
diff_arr=[0]*(n+2)
for l,r,chunk in operations:
    diff_arr[l]+=chunk
    diff_arr[r+1]-=chunk
diff_arr=list(itertools.accumulate(diff_arr))

for i in range(n):
    array[i]+=diff_arr[i+1]
print(*array)

sorry I didn't find where to submit the pull request, but hope this helps

@bqi343
Copy link
Member Author

bqi343 commented Jul 4, 2024

@Varsshhh Please follow the instructions here: https://usaco.guide/general/adding-solution

Pull requests: https://github.com/cpinitiative/usaco-guide/pulls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content content-related issue good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants