×

# Enigma2018

 0 Can someone please explain me the approach to solve this problem https://www.codechef.com/PLCO2018/problems/KILLLAZ asked 18 Jan '18, 17:54 3★kunal12 44●5 accept rate: 0%

 1 You need to arrange N numbers, and the arrangement must contain a given subsequence of length M. First of all, check if its possible, ie., if all the M numbers are distinct. Then, since the order in which the M numbers appear is fixed, we just need to find the number of ways in which you can put the other N-M numbers in N positions. After that, the remaining M numbers will be placed in the leftover spaces. The number of ways in which you can put N-M numbers in N positions is Np(N-M) = N!/M!. answered 18 Jan '18, 18:35 1.4k●12 accept rate: 28% If some elements in the m sized array are same then the answer would be zero right ? Else n!/m! (18 Jan '18, 19:33) kunal123★ @kunal12 Yes. (18 Jan '18, 20:45) 1 Got it... thankyou @hemanth_1 :) (18 Jan '18, 22:04) kunal123★
 1 Suppose you have n=4,m=2 . You can place the remaining 2 elements in 4 * 3 ways. For n=5,m=2 ,you can place the remaining 3 elements in 5 * 4 * 3 ways.Observed some pattern?Rest I'll leave it to you to know how. You can refer this Code answered 18 Jan '18, 18:44 146●4 accept rate: 27% Access is denied to this code :/ (18 Jan '18, 18:49) kunal123★
 0 Who to approach this one from the same contest, help please https://www.codechef.com/PLCO2018/problems/PRMSWP answered 21 Jan '18, 15:46 2★merajeev 1●1 accept rate: 0%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×191

question asked: 18 Jan '18, 17:54

question was seen: 350 times

last updated: 21 Jan '18, 15:46