usaco-guide icon indicating copy to clipboard operation
usaco-guide copied to clipboard

Complete Incomplete Sections in General - Silver

Open bqi343 opened this issue 2 years ago • 6 comments

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

bqi343 avatar Feb 18 '23 22:02 bqi343

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

SansPapyrus683 avatar Mar 03 '23 22:03 SansPapyrus683

the last quiz question is only in C++

bqi343 avatar Mar 03 '23 22:03 bqi343

image

what does this mean

SansPapyrus683 avatar Dec 29 '23 19:12 SansPapyrus683

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

bqi343 avatar Dec 29 '23 19:12 bqi343

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 avatar Jul 04 '24 17:07 Varsshhh

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

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

bqi343 avatar Jul 04 '24 19:07 bqi343