We invite you to participate in CodeChef’s Starters 25, this Wednesday, 9th February, rated for Div 2 & 3 Coders.
Time: 8 PM — 11:00 PM IST
Joining me on the problem setting panel are:
Contest Admin: Utkarsh Utkarsh.25dec Gupta, Lavish lavish315 Gupta
Setters: Utkarsh Utkarsh.25dec Gupta, Tarun tarun__m M, Soumyadeep soumyadeep_pal_21 Pal, Daanish Mahajan, Prakhar prako_87 Kochar, Abhinav abhinavvv306 Sharma
Testers: Tejas tejas10p Pandey, Abhinav abhinavvv306 Sharma
Statement Verifier: Daanish Mahajan
Editorialist: Kanhaiya mr_practice001 Mohan
The video editorials of the problems will be available on our YouTube channel as soon as the contest ends. Subscribe to get notifications about our new editorials.
Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here.
Hope to see you participating. Good Luck!
please tell about how to solve COUNT ARRAYS problem? is it dp(guessing that becuase of small m ) or is it some data structure problem?
Try to solve a subproblem. Suppose you have a simple cycle of length x. What are the number of ways to assign the values of each node such that no two adjacent nodes have same value. If you need any further help you can refer to the editorial published
For count arrays, is it possible to find out the answer for the cycle using inclusion-exculsion? I tried but kept on getting WA.
Yes, It can be solved using inclusion-exclusion. Let us label the edges as $$$\{1,2,...,n\}$$$ in the order. Also, let $$$ R \subseteq \{1,2,...,n\} \text{ and } S_R$$$ denote the number of ways of assigning values to the nodes such that values across the edges in $$$R$$$ are equal. Total number of ways $$$(f_n)$$$ of assigning values to n nodes in a cycle such that adjacent values are different can be computed as —
and,
where, m is the number of possible distinct values to label each node.
Thanks. I missed the special case for |R| = n.
i dont understand editorial of k distinct array....anyone pls explain ?