why is the code giving WA
sum has to be long .Same case happened with me for 1 hour.
defined as long long int already above
a not used.
For the first query, you are incrementing your sum by b[z] if z is zero. You are just adding the destination floor.
If the query is 3 1, it should count 4 floors, your code will count only 1.
int r=new int [q][n]
okh I understand thanks
btw it should count 5
oh yeah sorry my bad. It’ll be 5.