usaco-guide
usaco-guide copied to clipboard
Complete Incomplete Sections in General - Silver
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
- [x] Java: Silver - Binary Search
- [ ] Python: General - Debugging, Bronze - Sorting & Sets, many Silver modules
i'm ctrl f-ing in the silver binsearch module and don't see any <IncompleteSection>
headers?
the last quiz question is only in C++
what does this mean
there are probably better command line tutorials than the ones in the module
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
@Varsshhh Please follow the instructions here: https://usaco.guide/general/adding-solution
Pull requests: https://github.com/cpinitiative/usaco-guide/pulls