CodeChef shows it as a 'Wrong Answer'

Hello! I am kind of new to CodeChef and this is my 2nd code, obviously after Life, Universe and Everything. The logic I used is fine and the output is also correct. Yet it’s a wrong answer. Please help if you spot a problem. Here’s the solution:

Thanks in advance :slight_smile:

On my machine, it gives the wrong output for the Example Input.


That’s odd, because on my machine, it works seemlessly. It would be helpful, if you could provide details about the errors or faults in the code.

I’ve just tried it with the Codechef IDE, and it gives the wrong answer there, too - the same wrong answer as I get on my machine:

[~/devel/hackerrank/otherpeoples]>echo "2                   
manutd 8 vs. 2 arsenal
lyon 1 vs. 2 manutd
fcbarca 0 vs. 0 lyon
fcbarca 5 vs. 1 arsenal
manutd 3 vs. 1 fcbarca
arsenal 6 vs. 0 lyon
arsenal 0 vs. 0 manutd
manutd 4 vs. 2 lyon
arsenal 2 vs. 2 fcbarca
lyon 0 vs. 3 fcbarca
lyon 1 vs. 0 arsenal
fcbarca 0 vs. 1 manutd
a 3 vs. 0 b
a 0 vs. 0 c
a 0 vs. 0 d
b 0 vs. 0 a
b 4 vs. 0 c
b 0 vs. 0 d
c 0 vs. 0 a
c 0 vs. 0 b
c 1 vs. 0 d
d 3 vs. 0 a
d 0 vs. 0 b
d 0 vs. 0 c
" | ./
manutd arsenal
d b

There was a small bug in your code, i just added one more line to your code and wrote a comment in front of it, check it out ---->>

1 Like

at line no. 39