I want to know what is wrong with my code:
Question Link: https://www.codechef.com/CFUS2020/problems/CFS2005
My submission: https://www.codechef.com/viewsolution/38006269
I have applied basic combinatorics.
Please Help!!
I want to know what is wrong with my code:
Question Link: https://www.codechef.com/CFUS2020/problems/CFS2005
My submission: https://www.codechef.com/viewsolution/38006269
I have applied basic combinatorics.
Please Help!!
I think you’ve calculated totdiff wrong.
totdiff = (no. of paths from (0,0) to (x1,y1))x(no. of paths from (x1,y1) to (n,m)) +
(no. of paths from (0,0) to (x2,y2))x(no. of paths from (x2,y2) to (n,m)) -
(no. of paths from (0,0) to (x1,y1))x(no. of paths from (x1,y1) to (x2,y2))x
(no. of paths from (x2,y2) to (n,m))
We’re excluding paths through both point 1 and point 2 as they are counted twice (Inclusion-Exclusion principle)
Yes you are right thank you very much