# LAZER - Video Solution (MARCH20)

Hi,
I have created a video solution for the problem LAZER under march long challenge 2020.

2 Likes

suppose 13 y values are given
query is (6,13,2) ,now you are sorting the y values that lies in (6,13) range then how you are including the minimum ones and how u are removing the previous maximum values?

but a line segment has two y values ,you cannot include both ?

how you are updating the value in the code??

Iām not able to follow you.
I am only sorting the queries in increasing order of y value.

1 Like

Bro please can you add comments in code at starting of function and starting of for loop so beginner like me can understand what logic that statement are implementing.

and thanks for video solution it is really helpfull !!

1 Like

Next time ill make sure.

1 Like

what are we doing in the while loop ?, sir can you help me out
how does it is iteating?

int get(vector &tree, int idx) {
int result = 0;
while(idx) {
result += tree[idx];
idx -= idx & (-idx);
}
return result;
}

i think this function returning prefixsum (i.e from starting to index idx)of no. of active lines currently present in fenwick tree.

1 Like

get() is a query function for fenwick tree.
In my code, it will return no of active lines having (x coord) <= idx.

2 Likes