Help regarding MIKE3 In March challenge 2014

I solved the problem MIKE3 which is giving me a correct answer for all random test cases i give to it but the OJ is giving me a WA for some reasons. here is my solution non documented version or documented version on pastebin

In the solution which is documented enough for a good understanding i have reduced the problem to find the sets of the group(offers) which cant be dealt with together and used an array named graph to store this to find the solution.

Help find the error in this algorithm/code !

Approach is try all possible combination 2^20. using DP

1 Like

no i don’t want to change the approach , my algorithm looks mathematically sound to me but i want to know what went wrong

What is your criteria to select a customer?

Simply trying all possible combination is fine. DP is not necessary.

1 Like

@randomizer I followed an approach similar to yours in making the m * m matrix denoting intersections but after that i used an exponential solution (of order O(m)*m ) to get the answer. here is link to my solution for reference right now. I will tell you what is wrong with your code in some time.

1 Like

Ya you may ignore DP part. just use recursion

thanks @kcahdog

Following assumption

//this piece finds the possible groups
which can sit starting from the [row]
which has lowest number of 1s because
it will have least number of
collisions

Looks incorrect.

Your criteria for selecting the customer with minimum clash is wrong.
This the test case answer is 3. test
100 9
1 1
3 2 1 9
3 3 1 9
3 4 1 9
3 5 1 9
3 6 1 9
5 2 3 4 5 6
2 6 7
2 7 9
Your program giving 2.

1 Like

can you provide me a test case which proves this ? or some proof why it will not work

@randomizer I dont see any reason why you should downvote this answer. He was just trying to help. @jangwa retaliation is just as bad :smiley:

Can you explain how the answer is 3 ? I believe it is 2.

1 Like

point taken @kcahdog

Let people feel that codechef give equal right to every one. @kcahdog

sorry : this is
100 9 1 1 3 2 1 9 3 3 1 9 3 4 1 9 3 5 1 9 3 6 1 9 5 2 3 4 5 6 2 6 7 2 7 9

15 8 <\n>
2 1 15 <\n>
2 1 2 <\n>
2 3 15 <\n>
5 2 3 4 5 6 <\n>
5 2 3 7 8 9 <\n>
2 4 7 <\n>
2 5 8 <\n>
2 6 9 <\n>

2 Likes

thanks for that test case finally getting close to finally debug it :slight_smile:

thanks for the test case :slight_smile: