You are not logged in. Please login at www.codechef.com to post your questions!

×

How to approach the question CHAOS .

1
1

What should be approach for the question CHAOS

        https://www.codechef.com/EXTE2015/problems/CHAOS

asked 04 Nov '15, 14:08

docodon's gravatar image

4★docodon
776
accept rate: 0%

edited 05 Nov '15, 14:40


N = 14 M = 2

_ X1 _ _ X2 _ _X3 _ _

here Xi denotes chaotic cities.

let C denotes no of cities between particular consecutive chaotic city. The order in which cities become chaotic range from 1 to N-M thus we have to find no of ways of selecting C orders out of N-M = combination(N-M,C); once order has been selected ,cities present on these order will permute among them self. e.g. there are 3 cities between X1 & X2 let we numbered it as 1,2 & 3. no of ways of arrangement are:(because of constraint of chaosing) 1 2 3

1 3 2

3 1 2

3 2 1

= 4

we can find for any n consecutive as: 2^(n-1) //22....(no of candidate for ith position of selected order ) 2...*1

thus number of ways of order cities between Xi & Xi+1 = comb(N-M,C) * 2^(C-1)

after set,no of available orders are :N-M-C

do this for all cities between consecutive chaotic cities and multiply them. find no of ways of order cities(p) before 1st chaotic city as:comb(remaining orders,p) and multiply it. after multiplication you will get answer.

feel free to ask any question:)

link

answered 06 Nov '15, 21:38

anil0004's gravatar image

3★anil0004
263
accept rate: 50%

crystal clear explanation !! thanks buddy :)

(06 Nov '15, 23:03) docodon4★
link

answered 05 Nov '15, 15:51

packers0022's gravatar image

0★packers0022
-35
accept rate: 0%

Packers And Movers Bangalore" prompt moving, relocation and shifting services for people and corporation moving to "Bengaluru" and round the India. For Movers Packers Bangalore city full target report on supply of revenue and effective Movers Packers in Bengaluru, contact today 08290173333. We include our network in major cities like Bangalore, Haridwar, Gurgaon, Chandigarh, Delhi NCR, Pune, Hyderabad, Chennai, Noida, Jaipur, Bhubaneswar, Mumbai, Lucknow, Patna, Bhopal, Ahmedabad and Kolkata.@ http://packersmoversbangalore.in/ alt text

link

answered 19 May, 16:36

diksha12345's gravatar image

0★diksha12345
-213
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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:

×882
×2

question asked: 04 Nov '15, 14:08

question was seen: 1,144 times

last updated: 19 May, 16:36