5-gon's blog

By 5-gon, history, 2 years ago, In English

I was solving a problem in CF. So, I came up with an idea(don't know if it would work for sure)..I implemented the code. While I was testing the sample input..it successfully passed! But when I submit the problem, the sample didn't passed. Then I tested it in the CF custom testing but it showed me the same result that the sample test cases failed! But my editor showed me that all samples passed. So, I tested it on codechef editor & online c++ compiler. They showed me my test cases passed! Don't understand what happened! Is there any issue on CF compiler or testing?

Problem link: 701C - They Are Everywhere

My Code -> (https://ideone.com/8H7sXX)

The input - 7 bcAAcbc

The real output - 3

The output showed me — 2

  • Vote: I like it
  • -11
  • Vote: I do not like it

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

Look into how to run your code with address sanitizer enabled (or using valgrind). It'll show where you go out of bounds on an array and cause undefined behavior.

https://codeforces.com/blog/entry/15547