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

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

Recently I was solving 1677B - Tokitsukaze and Meeting task and came up with a solution involving range sum update and point query. I implemented this simply using a Lazy Segment Tree for which I used this template from sharmaharisam.

However, my code gave a runtime error on test case 3 with GNU G++17 7.3.0 set as compiler but got AC with GNU G++20 11.2.0 set as compiler. I have no idea why this is happening but need help so that I can answer what is that which is not supported with the GNU G++17 that leads to the runtime error.

Here is the G++17 submission: 223460126 Here is the G++20 submission: 223458461

The two codes are exactly the same.

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

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

The same happened with this submission: 223460828. I am now extremely curious about what in this template is causing this because all I can see is some standard non fancy C++ functions :)

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

in push_down function

if(2*v + 1 <= 4*n) {
    //...
    lazy[2*v + 2] = combineUpdate(lazy[2*v+2], lazy[v], tm+1,tr); 
}

Definitely incorrect expression in if. I'd say it must be 2*v + 2 < 4*n. But it's up to you to check.

Counter test (got with random generation):

1
7 6
110000111000010000000011011101011000100100