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

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

This was my initial submission for the problem: https://codeforces.com/contest/1815/submission/237704790

However just changing the value of arr[0] to something a lot lesser, the code becomes accepted: https://codeforces.com/contest/1815/submission/237704230

The algorithm is pretty straightforward (as seen from my code) but why should the value of arr[0] be so less? isn't -(1e9 + 1) small enough for it? If you can help, perhaps by giving a test case which fails for the initial submission I will be grateful

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

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

This is because you would have to decrease the value more than once by 1e9. For example case 1 1000000000 1 1000000000 1 Here you can see you need to decrease first element more than once which goes less than -1e9