Procon 2015 Editorials

Revision en1, by 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)

Tags esya, prosort, iiitd, editorials

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English ashish1610 2015-08-08 21:55:19 122
en6 English ashish1610 2015-08-08 21:39:25 767
en5 English ashish1610 2015-08-08 18:57:06 2
en4 English ashish1610 2015-08-08 18:56:35 37 Tiny change: ') == 0))).\nGrap' -brh3
en3 English ashish1610 2015-08-08 18:51:23 92
en2 English ashish1610 2015-08-08 18:49:01 2688 (published)
en1 English ashish1610 2015-08-08 15:43:49 1307 Initial revision (saved to drafts)