CLETAB Getting WA ,need a good Test Case

http://www.codechef.com/viewsolution/4494141 .
Can anyone suggest a good test case which is making my code go crazy…thanks in advance.

1 Like

Try these cases :

Input:

10

2 9

1 2 3 1 4 1 3 2 2

2 9

1 2 3 1 4 2 3 1 2

2 9

1 2 3 1 4 1 3 1 2

2 10

1 2 3 1 4 2 3 1 1 2

2 8

1 2 3 1 2 3 1 1

2 9

1 2 3 1 4 3 1 2 2

2 8

1 2 3 1 2 3 1 2

2 9

1 2 3 1 4 1 3 1 1

2 10

1 2 3 1 4 2 3 2 2 1

2 8

1 2 3 1 2 3 2 2

Output:

6

6

6

6

5

6

5

5

6

4

I guess these cases will help.

your code has 2 mistakes-

  1. you are initialising maxindex=-1 for every index in your for loop so it does not really remembers the last value of maxindex…instead u should initialise it just before the for loop

  2. after replacing an element with the current one, you need to update the array present…present[a[j]]=1…in the end

i think this should work after correcting the above things

For the forth test case,output should be 6 instead of 5.

The 4th test case output is missing . You gave a total of 9 outputs instead of 10 . It will be 6th . And btw my code satisfies all your test cases but it still gives WA :frowning: http://www.codechef.com/viewsolution/4558363

1

2 14

1 2 3 1 3 1 3 1 3 2 2 2 2 2

-> result is 4