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

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

can any one help me in finding wrong test case

i cant figure out from codeforces wrong submission report

problem link :1490-G my submission :check here

thanks in advance UPD : got the mistake, array should have been long long type , instead of int type

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

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

The problem with your logic is how u are storing prefix. The prefix array wont be monotonically increasing. Consider the array $$$2, -3, -5, 10$$$. The prefix array would be $$$2, -1, -6, 4$$$. So you can't simply use lower_bound as it won't give correct position. So to solve this problem only store prefixes (with corresponding positions) that are in increasing order, i.e $$$2, 4$$$. In this you can use lower_bound and get the correct result.

My implementation

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

    hi , i think my prefix array is non decreasing as it stores max of previous max_sum or current sum.Though I think array name made it a bit confusing as it doesn't stores prefixes at all .

    ps : thanks for your code

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

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