KMHAMHA - Editorial

@kevinsogo thanks.

@kevinsogo Thanks for the failing case.

thank you Ahmed and Vikrant for pointing that out…now i know what my method missed… i am still very new to coding and unaware of many of the algorithm that are used and explained in editorials
i just guessed the method and implemented it…maybe my approach is what they are calling “GREEDY” algorithm and that’s why it failed…
Thanks again

@Kevinsogo, Can u please give a case where this solution fails CodeChef: Practical coding for everyone

hi admin ,plz tell me where my code fails.
http://www.codechef.com/viewsolution/2847127

Here’s a test case I posted in one of the other kmhamha threads

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

The answer should be 9. It looks like this:

.......XXXX
.......XXXX
.....XXX...
....XXXX...
...XX......
...XX......
XXXXX......
XXX........
XXX........
XXX........

@kevinsogo do you have a file of test cases or could you generate a file of some challenging test cases? It will be really helpful as a lot of people are having doubts in this question

@kcahdog I compiled all the test cases so far into this link, plus a few programs that generate test cases. You might want to look at it (suggestions welcome).

@kevinsogo Thanks a lot. Could you post it as a separate post from this as it will be better for people to access.Also could you post some short notes on how to generate such test cases for future reference?.I already found the test case for which my code failed but it will be better for others who want to debug theirs.

@kcahdog Thanks for the suggestion. I made a separate post here.

int newid = hashX.size();
adj[newid].clear();

I am not getting the above part in the tester solution. Why we need to clear the adj[newid]? Plz. someone explain it…

Nice editorial.

Yes, you need to study max-flow min-cut algorithms. :slight_smile:

Sorry, misunderstood the problem statement (input format). I thought you are given NxN matrix. :slight_smile:

1 Like

@sylap nahilow sylap aga, gowumy yagdaylar :slight_smile:

@garakchy shukur gowy siz nahili? :smiley: