Pagini recente » Diferente pentru algoritmiada-2009/runda-1/solutii/kprime intre reviziile 2 si 3 | Solutii Algoritmiada 2011 Runda 2 | Diferente pentru blog/square-root-trick intre reviziile 94 si 95
Nu exista diferente intre titluri.
Diferente intre continut:
The query is interesting. The elements of the first and last slice (partially contained in the queried range) have to be traversed one by one, but for slices completely contained in our range we can use the values in $S$ directly and get a performance boost.
p. Here is an update example:
!<{margin-right: 20px; auto;display:block;}blog/square-root-trick?image01.png!
!{margin-right: 20px; auto;display:block;}blog/square-root-trick?image01.png!
p. In $update(6, 5)$ we have to change $A[6]$ to 5 which results in changing the value of $S[1]$ to keep $S$ up to date.
!<{margin-right: 20px; auto;display:block;}blog/square-root-trick?image00.png!
!{margin-right: 20px; auto;display:block;}blog/square-root-trick?image00.png!
In $query(2, 14)$ we get <tex>A{2} + A{3}</tex> <tex> + (A[4] + A[5] + A[6] + A[7]) + (A[4] + A[5] + A[6] + A[7]) + A[12] + A[13] + A[14] = A[2] + A[3] + S[1] + S[2] + A[12] + A[13] + A[14] = 0 + 7 + 11 + 9 + 5 + 2 + 0 = 34</tex>
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.