Regarding CHEFDAG

So, I have made a solution that I have tested using multiple approaches and it presents the solution on all testcases as correct and optimal! But, when I submit it, all testcases fail (WA, not TLE). I have checked the output format also, and it’s as required! Any other things I should check? Or any other help? because, I am sure that the answer my solution gives is the optimal one, and , I have also checked manually!

If after the contest, you can prove that your solution is optimal, and gives a better answer than the intended solution, then the testcases will be changed.


When you have prepared a solution for a problem and you are damn sure, this solution is perfectly correct. But it still shows WA. That means you are really wrong somewhere and missing some point somewhere. So, brainstorm!
That is what you learn in CP!
–You can be blatantly wrong even when you are full sure, you are correct.


The reason I am saying that I am sure is that, I have made a tester that tests my solution with a brute force solution and have tested it like around 5-6k times. I don’t mind if I am wrong somewhere, that’d be a good lesson.

Whom do I reach out to for that? Even if there’s an issue or a corner case left out, whom and how should I ask for an opinion or testing?

give me a link to your solution and i will try to hack it

1 Like


Try this testcase:
4 2
1 2 4 3
1 4 2 3

Your solution answer 1 in the first line but the graph you build has 2 nodes without incoming edges. In fact the answer should be 2.

@carre, could you please hack this solution , same problem CHEF AND DAG , CodeChef: Practical coding for everyone

I don’t even have a java compiler :crazy_face:

@carre but you can try it on codechef compiler :thinking:

Yes but I can not stress it with many testcases without been there hours…you also can do it that way, take any accepted solution, create a testcase and compare results. It’s not funny to me to do that and you can do it by yourself anyway

1 Like

@carre , thanks for your suggestion , I will try that :slightly_smiling_face:

Should i need to learn the barpitite maximum matching algorithm to solve this problem?

I would say so, yes

My solution gives the answer… 2 3 0 3… which is an appropriate solution

@carre Hello I’m really sorry to trouble you but can you please hack my solution too :sweat_smile:
I got what the solution should be but couldn’t get any corner case why it was getting wrong for the solution I did in the contest.

10 2
3 10 6 2 5 7 8 9 1 4
8 7 4 6 2 1 5 3 10 9

The answer should be 4

1 Like

the first line is the number of nodes without incoming edges and your solutions says it is only 1, while the correct answer is 2. The complete answer your solution is giving is:
2 3 0 3

The second line is correct but not the first one