Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

Geekarka's blog

By Geekarka, history, 4 hours ago, In English

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.

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

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Geekarka (previous revision, new revision, compare).

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

you can check for your solution y=5

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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