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

Автор memphis24, история, 7 лет назад, По-английски

I have a doubt regarding the third problem of September Long challenge ,SEREJA and COMMANDS.

Can someone help me out and tell me what is wrong with my code.What I did was I iterated through all the commands backwards and for any command of type 2,first I did the query operation on the segment tree to find how many times that command was getting executed and then I performed an update operation on the segment tree in the range l to r of the type 2 command.And for all the type 1 commands if it was from l to r , all I did was first the query operation to get how many times it was getting executed(val) and then arr[l]+=val;ar[r+1]-=val; using the mod.

I was able to pass only subtask 1. Here's my code:

https://www.codechef.com/viewsolution/15378534

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

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

Dude, i think , u don't know the subtraction modulus concept. (A-B)%M=(A%M — B%M + M)%M; In line 76, you are doing that mistake. Correct it , get AC and thank me after.