Hello all, I'm Geekarka and I got wrong answer on pretest 2 11th testcase in my 271612109 for the problem 1990B - Array Craft of Codeforces Round 960 (Div. 2). The testcase is 5 2 1 (n=5, x=2, y=1). My output is 1 1 -1 -1 -1. The correct answer is 1 1 -1 1 -1. I will be very grateful if someone helps me understand this. Thank you.

Auto comment: topic has been updated by Geekarka (previous revision, new revision, compare).you can check for your solution y=5

it's logical error basically you are making array from index y to x as 1 and set remaining to -1 however this is a wrong idea I give you a example consider input n=11,x=7,y=6 the array will be [-1 -1 -1 -1 -1 1 1 -1 -1 -1 -1] the max prefix position will be 1 and max suffix position will be 11 because -1 is the maximum cumulative sum you can get from 1 to n or n to 1 which doesn't satisfice the input

thanks

this was the idea i first thought about in the contest which failed, but:

if you want to know why your answer is wrong this is because $$$y$$$ here isn't the maximum suffix position of your array, if you look at the definition, it says: the maximum suffix position of b is the

largestindex $$$i$$$ that satisfies ...here in your example for y=5, the sum will be => -1

and for y=1(which should be more than $$$-1$$$) the sum will be => 1+1-1-1-1 = -1 , so the maximum suffix position in 5, not 1.

if you want to know the correct answer click the spoiler

the answerThanks a lot!

I'm happy I could help