Help me understand the question Finding Teammate Problem Snackdown

I dont want solution to the question I am just not able to understand the question properly.If anybody have solved it then please explain the question with few test cases

I had the same problem. I asked in comments section but no one is replying. Statement seems unclear to me and some of my friends too.
Though I solved it anyway now.
But it’s not your fault.
But I can’t help as it will against rules.

Can anyone please give me a tricky test case? I’m getting wrong answer for I think some special test case

What is meant by valid pairings?
There can be two meanings:
(1) For each pair/tuple
(2) For the entire arrangement of all possibilities of the entire N people.

P.S: The question is really not clear in its language.

You won’t be provided test cases when the contest is going on. You can again ask when the contest will get over.

1 Like

Question is fine. It assumes some familiarity with mathematical terms and because it is an ongoing contest. We cannot explain those terms to you. So please stop spamming this forum.

now that the contest is over can somebody give a solution please?

@vijju123 Can you provide us your solution for Problem Code: TEAMMATE ?

My doubt is -> In the sample, why isnt the pairing (3,8) (1,7) valid? IN this case A is greater than C but D is less than B.

I did the math behind this question and my friend implemented it in python.The question is correct but I am new to codechef. So i don’t know if I can discuss it here. I can give you hint where your code might give incorrect result.

  1. 1 2 2 2 2 3 Ans->12
  2. 1 2 2 3 Ans->2
  3. 1 1 2 2 2 3 Ans->3

I will discuss how I approached this problem at my blog here link text

@chari407 (3,8)(1,7) is not a valid test case because 7 and 8 index students are more talented than those with whom they are paired.It does not literally means the position (a,b) and (c,d) but it was there to explain the question.

The solution is

  1. Sort the list S(The list containing the quality index of programmers)
  2. count the occurrence of each Si
  3. You take a variable ans. You start multiplying it with factors for each Si by the following rule till you reach end of Si list.
  4. if Si is odd number say m then Multiply ans by m*(m-2)(m-4)…*1
  5. if Si is even number say n then index of it’s last occurence/first occurence is taken.
  6. if index is even then
    Multiply ans by n*(n-1)(n-2)(n-4)(n-6)…*1
  7. if index is odd then multiply by (n-1)(n-2)(n-4)(n-6)…*1
  8. Notice it is different for odd and even index in even number frequency

How I got this result?

  • I’ll upload the method to reach the result in my blog tomorrow link text

7 wants to be paired with 8, and 8 wants to be paired with 7. Remember, the pairs are unordered.