Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

FruitLoop's blog

By FruitLoop, history, 9 years ago, In English

Given an array A of n integers. M queries are given in the form of l, r. For each query, I need to count the number of inversions in subarray A from l to r. I know the offline approach to solve this using BIT and sqrt decomposition.

Is it possible to solve this problem online using segment tree or any other data structure?

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it