ShaoNianTongXue5307's blog

By ShaoNianTongXue5307, history, 22 months ago, In English

https://mirror.codeforces.com/blog/entry/113075

today i read this blog and found a very useful trick i will introduce it to such interval problems consider constructing a cartesian coordinate system for an interval $$$[x,y]$$$ and mapping it to the point $$$(x,y)$$$ for the query operation stated in the blog given $$$(l,r)$$$ translate to coordinate points is to ask how many points there are in a certain rectangle then the problem was transformed into a simple one then lets say mos algo put each $$$[l,r]$$$ on the axis then the problem becomes that you can go up down left right and ask for the minimum number of times to traverse all the points so that you can understand mo more intuitively lets take another example of a topic i encountered while talking with my friend my friend asked there is an array that supports swapping two numbers and querying the number of inverse pairs my friend wants to know if there is anything below $$$O(n\log^2n)$$$ just put $$$(i,a_i)$$$ to the coordinate points then the problem becomes to support modifying the coordinates of a point and querying the number of points inside a rectangle it is impossible to go below $$$O(n\log^2n)$$$ you can see that this trick is very helpful to think about the problem try using this method of thinking when you encounter problems with interval bounded comparisons

I hope you enjoy my blog!!!

  • Vote: I like it
  • -14
  • Vote: I do not like it

| Write comment?
»
22 months ago, # |
  Vote: I like it 0 Vote: I do not like it

https://i.328888.xyz/2023/02/21/gbD63.png

this is the mo shown in this method the vertical red line is $$$\sqrt{n}$$$ the black dots are queries and the red line linking all the black dots is the mo operation im also sorry that the shift and punctuation keys on my keyboard are broken so i cant type them

»
22 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Your typesetting are so trash that i can't understand it at all.

  • »
    »
    22 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    this is a good practice opportunity not my typesetting is too trash you should thank me