Wrong answer in RECCKT- CRICKET TOURNAMENT question. Please tell why?

Pls tell why i am getting wrong answer. This is the link to my solution. What am i missing?

Also, this is the question : CodeChef: Practical coding for everyone

Simple Solution is:

max_difference=INT_MIN
smallest=a[0]
for(i=1;i<N;i++)
    if(a[i]<smallest)
         smallest=a[i]
    else if(max_difference<a[i]-smallest)
         max_difference=a[i]-smallest
print max_difference

Hope you got it!

1 Like

Thank you for your answer and I get your approach…but it would be very kind of someone if they tell what’s wrong with my program. Cause i cannot find anything wrong in it…

@surbhijain93

I tested your code on about 100 test cases and here is the result:

Test Cases:

100
9
13 17 19 14 2 11 15 12 7 
9
13 17 3 9 12 10 2 4 15 
6
19 15 13 6 5 18 
6
5 14 18 17 10 19 
7
12 10 5 17 8 11 6 
5
12 4 2 6 13 
6
4 5 2 3 18 17 
5
17 12 14 8 19 
6
19 2 13 5 17 11 
5
8 4 6 14 13 
5
8 10 3 6 18 
7
2 10 18 11 17 8 14 
5
9 15 13 12 2 
8
15 17 7 3 4 11 6 16 
8
10 13 9 5 2 12 15 3 
6
9 11 1 19 15 18 
7
12 18 8 7 13 6 14 
9
16 14 17 12 13 2 1 18 10 
8
14 7 19 4 6 17 3 1 
8
16 9 11 6 14 12 17 8 
9
9 1 6 5 11 7 8 16 2 
7
11 16 2 10 18 15 9 
8
13 5 11 6 3 8 7 1 
8
14 5 9 12 15 1 17 13 
5
10 17 11 2 9 
6
17 7 16 19 12 18 
8
14 7 11 18 13 5 10 15 
6
8 11 3 7 17 16 
8
12 17 8 13 16 3 15 18 
7
8 12 15 6 14 1 16 
9
4 3 6 11 18 17 9 8 12 
7
5 3 17 7 1 14 16 
6
18 8 12 19 3 2 
8
6 18 4 14 8 1 12 9 
5
14 3 1 2 4 
8
18 19 7 12 14 9 17 8 
6
7 17 16 12 2 6 
9
4 2 11 16 1 13 18 15 14 
5
14 9 12 7 15 
5
1 14 6 11 3 
8
17 8 13 5 2 3 7 14 
9
1 10 17 15 13 8 9 6 11 
8
12 4 14 13 7 15 9 8 
8
4 5 14 1 9 13 10 16 
7
1 5 14 18 19 4 17 
5
5 10 11 7 15 
6
10 14 7 15 17 8 
9
4 15 3 1 9 11 17 5 12 
9
17 3 2 18 9 4 6 19 8 
7
19 1 6 3 12 8 11 
6
18 16 15 8 1 4 
8
16 2 9 13 17 6 10 4 
9
19 2 16 4 11 7 14 18 17 
7
6 10 17 16 5 13 1 
8
17 10 3 14 8 2 11 16 
9
5 15 18 6 2 3 1 10 14 
9
7 11 2 19 8 3 17 12 15 
7
10 3 8 13 14 5 4 
8
15 17 3 10 6 1 16 14 
8
12 4 18 14 9 5 15 11 
5
17 9 18 15 4 
7
2 19 6 5 14 12 9 
9
13 1 14 16 11 17 3 10 5 
9
11 2 15 5 4 1 18 17 12 
8
2 10 16 4 6 13 12 8 
9
9 17 16 10 14 19 4 12 1 
9
7 5 18 19 14 11 13 15 1 
7
9 11 1 7 14 16 8 
7
7 2 8 19 18 11 12 
5
4 10 15 13 14 
8
3 2 14 8 1 17 4 5 
8
10 2 9 3 17 7 16 19 
7
14 9 15 2 5 3 4 
8
5 16 14 10 11 17 4 1 
6
4 16 1 19 17 13 
8
7 9 16 14 17 5 12 10 
8
14 18 11 6 17 4 7 8 
5
18 7 6 14 12 
7
6 18 10 17 5 14 1 
7
15 2 18 16 17 7 6 
7
14 7 18 16 17 6 8 
7
7 1 6 3 9 2 4 
8
14 17 3 9 7 4 2 5 
6
12 8 4 15 11 1 
8
2 6 9 1 7 4 18 12 
7
13 2 14 11 12 5 1 
7
3 5 16 12 4 9 13 
7
6 10 3 17 8 12 2 
9
18 10 15 13 19 14 6 17 11 
8
1 14 16 12 4 18 2 8 
6
12 9 1 13 6 14 
7
9 11 16 8 1 13 18 
7
12 8 9 16 2 17 19 
8
5 19 10 3 11 2 13 7 
9
11 1 3 6 2 8 18 15 4 
6
10 16 8 6 5 14 
6
16 19 11 6 4 3 
6
4 10 18 3 19 1 
5
11 8 6 7 16 
6
8 16 5 17 18 19 

On comparing your output file with correct output file

Result:

no
Error on test case number 1
Your Output = 17
Actual Output = 13

Error on test case number 2
Your Output = 15
Actual Output = 13

Error on test case number 3
Your Output = 14
Actual Output = 13

Error on test case number 9
Your Output = 17
Actual Output = 15

Error on test case number 13
Your Output = 13
Actual Output = 6

Error on test case number 14
Your Output = 14
Actual Output = 13

Error on test case number 17
Your Output = 12
Actual Output = 8

Error on test case number 19
Your Output = 18
Actual Output = 13

Error on test case number 23
Your Output = 12
Actual Output = 6

Error on test case number 25
Your Output = 15
Actual Output = 7

Error on test case number 27
Your Output = 13
Actual Output = 11

Error on test case number 32
Your Output = 16
Actual Output = 15

Error on test case number 33
Your Output = 17
Actual Output = 11

Error on test case number 34
Your Output = 17
Actual Output = 12

Error on test case number 35
Your Output = 13
Actual Output = 3

Error on test case number 36
Your Output = 12
Actual Output = 10

Error on test case number 37
Your Output = 15
Actual Output = 10

Error on test case number 41
Your Output = 15
Actual Output = 12

Error on test case number 50
Your Output = 18
Actual Output = 11

Error on test case number 51
Your Output = 17
Actual Output = 3

Error on test case number 53
Your Output = 17
Actual Output = 16

Error on test case number 54
Your Output = 16
Actual Output = 11

Error on test case number 55
Your Output = 15
Actual Output = 14

Error on test case number 56
Your Output = 17
Actual Output = 13

Error on test case number 59
Your Output = 16
Actual Output = 15

Error on test case number 61
Your Output = 14
Actual Output = 9

Error on test case number 66
Your Output = 18
Actual Output = 10

Error on test case number 67
Your Output = 18
Actual Output = 14

Error on test case number 73
Your Output = 13
Actual Output = 6

Error on test case number 74
Your Output = 16
Actual Output = 12

Error on test case number 76
Your Output = 12
Actual Output = 10

Error on test case number 77
Your Output = 14
Actual Output = 11

Error on test case number 78
Your Output = 12
Actual Output = 8

Error on test case number 79
Your Output = 17
Actual Output = 12

Error on test case number 81
Your Output = 12
Actual Output = 11

Error on test case number 83
Your Output = 15
Actual Output = 6

Error on test case number 84
Your Output = 14
Actual Output = 11

Error on test case number 86
Your Output = 13
Actual Output = 12

Error on test case number 88
Your Output = 15
Actual Output = 14

Error on test case number 89
Your Output = 13
Actual Output = 11

Error on test case number 94
Your Output = 17
Actual Output = 14

Error on test case number 96
Your Output = 11
Actual Output = 9

Error on test case number 97
Your Output = 16
Actual Output = 3

Error on test case number 98
Your Output = 18
Actual Output = 16

Enjoy Debugging… :slight_smile:

1 Like

@rishabhprsd7 : salute to your dedication brother towards answering

plz can anyone tell me where we can resubmit…
they are no where to be found.

Problems are currently not added in practise section. I mailed them yesterday, just saw their reply that they’ll be adding soon.

You can check by the link: codechef.com/problem/RECCKT

Thanks… :slight_smile:

@vishalgupta94 : problems are now added to the peer section.Now you can resubmit your solution :slight_smile:

here are the links of the problems: RECMSG Problem - CodeChef