Блог пользователя RedDragon

Автор RedDragon, история, 4 года назад, По-английски

This is my submission for problem D in CodeForces Educational Round 90 : 85049220 I used a maximum subarray approach. I took the difference between odd and even parity consecutive elements (gain in sum per pair) and stored them in a new array. After that I used maximum subarray on my new array and added that to sum of even numbers(initially). Pairs can be formed in two ways (0-1, 2-3, 4-5,... & 1-2, 3-4, 5-6,...); took care of that in two cases. Max subarray sum can be negative; took care of that too.

As you can see, the submission got WA in test case 3. And the test case is too big for me to understand the error. Can someone help in pointing out the mistake? Or give a small test case where my code would give a wrong answer?

Thanks in advance!

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

Автор RedDragon, история, 5 лет назад, По-английски

Submission : https://codeforces.net/contest/1327/submission/74093951

Can anyone explain what is going wrong in my code that is giving me runtime error. Also, what exactly does the error code specify, as in, about the nature of the runtime error. Whether it is an array out of bounds or something else

Any help would be appreciated

Thanks :)

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится