We have n recipes and n judges to taste them. Each judge must try every recipe exactly twice.
You have to organize tasting rounds. A round is is structured as follows:
You will choose distinct k recipes and for each one of them prepare 2 identical dishes.
You will choose distinct k judges and each of them must try 2 different recipes from the ones we chose (1 dish of each of them in particular). Two different judges may try the same recipe (but they may not share a common dish).
After each round all prepared dishes must be eaten by judges.
You can arbitrarily decide the number of rounds, and the structure of each one (number of invited judges), but as a rule of the contest at the end of all round each judge must have tasted every recipe exactly twice.
EXPLANATION:
This is a constructive problem, which can be solved by different ways. I will describe mine which is quite simple.
Let’s organize n rounds. You can imagine the recipes aligned in a circle. At the 1st round the ith judge is standing beside the ith recipe. In each round each judge tries the recipe he is standing beside and the next one in front of him. After each round our judges move 1 step around the circle. Check this solution for n = 4 :
Round
Judge
1st Recipe
2nd recipe
1
1
1
2
1
2
2
3
1
3
3
4
1
4
4
1
2
1
2
3
2
2
3
4
2
3
4
2
2
4
1
1
3
1
3
4
3
2
4
1
3
3
1
2
3
4
2
3
4
1
4
1
4
2
1
2
4
3
2
3
4
4
3
4
By scheduling rounds this way, it’s guaranteed that every recipe would be tasted by every judge exactly twice by the end of the nth round.
In the problem statement, it is written that x and y should not be same. So, in the explanation, (2 3 4 2) should be (2 3 4 1);
and (2 4 1 1) should be (2 4 1 2).
Correct me if I’m wrong. Thanks
If we can choose the same recipes from different dishes then for example if n=2, we print r=2 then for each round r print r1-1 1 1,2 2 2and r2- 1 2 2,2 1. Why this answer gives wa? I’m confused please correct me.
I believe this question has some issues. I got the correct answer only when I tried to print the answer in the pattern as used by the author. For n=odd I use the same order and for n=even,
eg n==4, I tried to print the pattern:
1 1 2
2 1 2
3 3 4
4 3 4.
Correct code: https://www.codechef.com/viewsolution/38001923
Incorrect code: https://www.codechef.com/viewsolution/38001575
Can someone please crosscheck as well?