I was trying to solve SEALCM of JAN long challenge-15.
problem link: problem link
this question can be solved by inclusion exclusion principle.
I have seen code of rajat1603
solution link: soln link
But I am unable to understand working of f[i][j] (line 84-100) and also some part of s1,s2,s3,s4,s5 and final.
It would be nice if someone can mention working of f[i][j] or provide his own way to solve this question by
For newbies like us It would be great if such explanations will be given…
I don’t know the solution, but your handle is amazing
My khopri is also amazing
Believe me,I am acquainted to you
Read this : [http://discuss.codechef.com/questions/62442/explaination-of-sealcm]
Well rather than looking at the code you should focus on understanding the concept first.
As i have said we have to calculate y = n(NOT(A) U NOT(B) U NOT© U NOT(D))
Take a = not(A), b = not(B), c = not©, d = not(D).
y = n(a U b U c U d).
Now first expand it using Inclusion-Exclusion Principle. Then , if you really understand Set Theory , you will be able to see that to calculate the answer you will also require deMorgan’s Law.
First do it on paper and then move to coding it i.e before coding fully expand y and write it somewhere then you would be able to grasp the real solution.
And first study the concepts mentioned in Bold characters.
I am not able to understand your uni function as well as lines 77-88.
I know inclusion exclusion principle and set generation but still I am not able tto get those part
Clearly,I have not implemented inclusion exclusion principle yet.
Could you please guide me??
You are the real champ!! I got it!
Still I want to confirm this::
Y = power(m-m/p,n)+power(m-m/q,n)+power(m-m/r,n)+power(m-m/s,n)-
power(m- m/p -m/q -m/r +m/(p*q)+ m/(q*r)+m/(p*r) - m/(p*q*r),n)+
- m/(p*q*r)-m/(q*r*s) - m/(p*q*s) - m/(p*r*s) + m/(p*q*r*s),n)
where p,q,r,s are A,B,C,D.
Is this your Y??
Yup that looks about right.