WA in SNACKUP

what is wrong with my following submission?
kindly help
my submission for SNACKUP

Can you explain what are you trying to do, in brief. I didn’t get that why are you printing n*n. Moreover, You can have a look to @vijju123 approach for this question, or explain me what are you trying to do.

Actually i followed the following approach:
Invited only 1 judge for each round,keep inviting the same judge until the judge tasted each of the n recipes exactly 2 times.
e.g. for n=2
Invited judge 1 for round 1 he tasted recipe 1 and 2
again invited judge 1 for round 2 he then tasted recipe 2 and 1
then invited judge 2 for round 3 he then tasted recipe 1 and 2
again invited judge 2 for round 4 he then tasted recipe 2 and 1
after round 4 each judge has tasted each recipe exactly twice.
thus for one judge i need n rounds,for n judges their will be n*n rounds?
where am i wrong,kindly guide me!

Actually i followed the following approach: Invited only 1 judge for each round,keep inviting the same judge until the judge tasted each of the n recipes exactly 2 times. e.g. for n=2 Invited judge 1 for round 1 he tasted recipe 1 and 2 again invited judge 1 for round 2 he then tasted recipe 2 and 1 then invited judge 2 for round 3 he then tasted recipe 1 and 2 again invited judge 2 for round 4 he then tasted recipe 2 and 1 after round 4 each judge has tasted each recipe exactly twice. thus for one judge i need n rounds,for n judges their will be n*n rounds? where am i wrong,kindly guide me!

I am debugging your code atm. Dont worry dear :slight_smile:

I think i found the bug dear.

IF you are inviting only 1 judge, then Ada will make ONLY 1 DISH. Eg-

If we invite judge 1, Ada will only make dish 1. And she will make 2 copies of dish 1.

Since she only prepares 1 dish, then you cannot print “j n (n+1)” where n is the dish id.

In other words, she prepared dish like {1,1} isntead of {1,2}. If we invite 2 judges, she will prepare {1,1,2,2}. Each judge can eat 2 dishes, BUT BOTH MUST BE DIFFERENT in a single round. In output section its specified that a judge cannot eat 2 copies of same dish.

What i did, was similar, i just invited ALL N JUDGES, and made then eat in “1 2” “2 3” “3 4” fashion. You can look at my code here- https://www.codechef.com/viewsolution/14284217

(I made the struct pairs just for convenience, so i dont have to worry too much about loops )

dear, u are inviting one judge at particular round… but according to question “u can’t invite less than two judge at particular round”. i came to know about this after reading this line from question as— “We will choose k distinct recipes and Ada will prepare two identical dishes for each of them.”
here “them” is used means judge should me more than one in particular round and 2 same dish should be given to them(more than one)…

here is link for mysolution, check it out dear its very easy approach solution link