Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Some guidance?

Правка en1, от RedDragon, 2020-06-25 19:56:40

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!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский RedDragon 2020-06-25 19:56:40 790 Initial revision (published)