Блог пользователя Joker1010123

Автор Joker1010123, история, 7 лет назад, По-английски

Hi everybody. I'm learning about SQRT decomposition and I want some problems. Can you give me? Thanks very much. ♥♦♣♠

  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

»
7 лет назад, # |
Rev. 2   Проголосовать: нравится +9 Проголосовать: не нравится

You can try to solve 3 problems below:

DQUERY

Sherlock and Inversions

Powerful array

»
7 лет назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

Ummmm...

LINK

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This one has many solutions, but SQRT decomposition is one of them: 242E - XOR on Segment
If you're stuck, then here is the code: 24227961

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    szawinis can u explain the solution ..help would be appreciated!

    • »
      »
      »
      7 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      You solve for each of the possible bits separately, then combine them later, since the query asks for sums. The reason why we do this is to make it more straightforward when applying the first query. This problem can also be solved using lazy segment tree which IMO is easier to code than SQRT decomp.

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This link might help you.

»
7 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Here's another one that can be solved with SQRT decomposition http://codeforces.com/problemset/problem/13/E and with some SQRT heuristics this one too http://codeforces.com/contest/797/problem/E