Procon 2015 Editorials

Правка en1, от ashish1610, 2015-08-08 15:43:49

Little Red Riding Hood and Candy Factory

The problem basically asks to check if the integer is even or odd. As integer is very large you can check if last digit is even or odd to decide the ans. If the integer is even than the ans is YES else ans is NO

Little Red Riding Hood and Convolutions


Convolution(L) = L1*L2*L3*L4 + L2*L3*L4*L5 + ........
Since only allowed values for L[i] is 1 or -1, we can say that the number of terms (Li*Lj*Lk*Ll) which evaluates to -1 are equal to number of terms which evaluates to 1. So, if we negate the given list the number of terms which evaluates to -1 or 1 doesn't change and we get another list L' whose Convolution(L') = 0

An Unfair Fair Game


Graph Sum


if m is odd than no. of ways are zero. if m is even then we have to make n/2 using 1 and 2.

which comes to be sigma(0 to n­1) (n­k­1) C (k) which is actually fibonacci number Fib(n).

taking last 5 digits is mod operation with 1e5. Fib(n) repeats after 150000 when we take mod

with 1e5.

now add the number to every vertex in path from v to vertex 1 (root).

use HLD to perform the queries.

it will take log^2(N) per query.

total complexity = N*log^2(N)

Теги esya, prosort, iiitd, editorials

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en7 Английский ashish1610 2015-08-08 21:55:19 122
en6 Английский ashish1610 2015-08-08 21:39:25 767
en5 Английский ashish1610 2015-08-08 18:57:06 2
en4 Английский ashish1610 2015-08-08 18:56:35 37 Tiny change: ') == 0))).\nGrap' -brh3
en3 Английский ashish1610 2015-08-08 18:51:23 92
en2 Английский ashish1610 2015-08-08 18:49:01 2688 (published)
en1 Английский ashish1610 2015-08-08 15:43:49 1307 Initial revision (saved to drafts)