Doubt in MIKE3

doubt
mike3

#1

I just want to know why my this submission didn’t worked but a recursive brute force worked. Can you give me a case where it fails.
Thank you :slight_smile:

I updated the link. Sorry for the confusion.


#2

I got that but I never got the case where it fails. Finally I wrote up the recursive brute force solution for this. Can you please provide me the case. And no my submission answered correct ans for all the cases that I made by my own.


#3

Please check this [Editing test case]

40 16
4 1 4 20 24
2 33 39
4 18 33 35 40
3 12 30 34
4 1 17 31 37
2 12 40
2 34 35
2 5 13
2 7 16
3 17 27 39
3 7 9 10
4 8 18 20 35
2 19 26
1 11
1 30
4 3 9 23 34

#4

@ashish1610 General advice for getting testcases where your code fails. As you have an AC, so I assume that you had a solution which was accepted, now what you can do is generate random test-cases and run both your AC and WA solutions and check where the solutions of both cases don’t match. This generally helps me, I dont know if this is a recommended thing or not but it has helped me a lot. In case I dont have AC solution with me, I use brute-force approach if my main aim is to know where it gets wrong.


#5

I am assuming it is 1 1 rather than 1 1 15 in 2nd line and 2 3 15 rather than 3 3 15


#6

It gave correct ans.


#7

I am sorry Ashish. It seems I made a mistake in understanding your logic.


#8

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


#9

Found it!!!
40 16
4 1 4 20 24
2 33 39
4 18 33 35 40
3 12 30 34
4 1 17 31 37
2 12 40
2 34 35
2 5 13
2 7 16
3 17 27 39
3 7 9 10
4 8 18 20 35
2 19 26
1 11
1 30
4 3 9 23 34

Expected 10, your program returns 9.


#10

Thanks @mjbpl