Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

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

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.

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

»
4 часа назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
4 часа назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

you can check for your solution y=5

»
3 часа назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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