Cover Them All! Logic Help

My Logic:

  1. First i compress the coordinates.
  2. Then when updating i use the fake coordinates i.e compressed coordinates as indexes for the BIT but for performing the calculation of updates i use the original coordinates by extracting original from fakes using the reverse map rm<int,int>.
  3. I store the bomb values using fake indexes. and when calculating i use the fake index to get the bombs;
  4. Also when i update i first check whther at that fake index when converted to original index by reverse map rm, is there actually any soldier present? I yes only then i update the BIT at that fake index.
  5. On querying i just get the sum from 0 to n in BIT.

Is My approach Wrong:?
Plz provide code if possible or just give the logic.

My Code: https://ide.codingblocks.com/s/113681

@apaarkamal
@Saurabh-Kumar-1331476656958199


check it out , if unable to understand then tell again

Explain your logic, unable to understand the code.
@apaarkamal
@Saurabh-Kumar-1331476656958199

used combinatorics and bit is teeling how many small numbers are there till that time which are inserted , so inserting and calculating together