<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>KokiYamaguchi</author_name>
  <author_url>https://blog.hatena.ne.jp/KokiYamaguchi/</author_url>
  <blog_title>Learning Algorithms</blog_title>
  <blog_url>https://kokiymgch.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>まず数列 $a$ の転倒数を求める問題を考えますより正確には $i a_j$ となるようなものの数を求める問題で，これは fenwick tree などのデータ構造を使って以下のように解けます fenwick_tree&lt;long long&gt; ft(MAX); long long ans = 0; rep(i, n) { ans += ft.sum(a[i] + 1, MAX); ft.add(a[i], 1); } まず今見ている値を不等式の右辺の値として計算結果に加算して，次に今後その値が不等式の左辺としてどれくらい結果に寄与するかというのを考えているだけですところで上記を踏まえると，一般に…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkokiymgch.hatenablog.com%2Fentry%2F2020%2F11%2F03%2F143606&quot; title=&quot;数列上の数の組み合わせであって不等式を満たすものの数を数える - Learning Algorithms&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-11-03 14:36:06</published>
  <title>数列上の数の組み合わせであって不等式を満たすものの数を数える</title>
  <type>rich</type>
  <url>https://kokiymgch.hatenablog.com/entry/2020/11/03/143606</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
