perfectionist7's blog

By perfectionist7, 20 months ago, In English

So, when I put in the language to be GNU G++20, the program shows testcase failed at testcase 27 which is

3 1 2 2 2 3

It shows I become the guy in the Participant's output section but when I run the exact same code in my VS Code, it shows the output as Oh, my keyboard! which is the same as the jury's answer. I can't really understand whats wrong.

My code —

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Me too!

»
7 months ago, # |
  Vote: I like it +1 Vote: I do not like it

So, the mistakes in this code is about indices. Your code is giving an out of bound error.

1) In line 19, when you do arr3[i]=arr[i], you know that arr only have length a, so it cannot have index till a+b.

2) In line 25, except of doing i<=a+b, do i<a+b.

Please make a habit to take care of the indices of the arrays when writing a code.