{"author_url":"https://blog.hatena.ne.jp/KokiYamaguchi/","provider_name":"Hatena Blog","title":"\u6570\u5217\u4e0a\u306e\u6570\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u3042\u3063\u3066\u4e0d\u7b49\u5f0f\u3092\u6e80\u305f\u3059\u3082\u306e\u306e\u6570\u3092\u6570\u3048\u308b","author_name":"KokiYamaguchi","url":"https://kokiymgch.hatenablog.com/entry/2020/11/03/143606","height":"190","version":"1.0","published":"2020-11-03 14:36:06","blog_url":"https://kokiymgch.hatenablog.com/","image_url":null,"categories":[],"width":"100%","blog_title":"Learning Algorithms","type":"rich","description":"\u307e\u305a\u6570\u5217 $a$ \u306e\u8ee2\u5012\u6570\u3092\u6c42\u3081\u308b\u554f\u984c\u3092\u8003\u3048\u307e\u3059\u3088\u308a\u6b63\u78ba\u306b\u306f $i a_j$ \u3068\u306a\u308b\u3088\u3046\u306a\u3082\u306e\u306e\u6570\u3092\u6c42\u3081\u308b\u554f\u984c\u3067\uff0c\u3053\u308c\u306f fenwick tree \u306a\u3069\u306e\u30c7\u30fc\u30bf\u69cb\u9020\u3092\u4f7f\u3063\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u89e3\u3051\u307e\u3059 fenwick_tree<long long> ft(MAX); long long ans = 0; rep(i, n) { ans += ft.sum(a[i] + 1, MAX); ft.add(a[i], 1); } \u307e\u305a\u4eca\u898b\u3066\u3044\u308b\u5024\u3092\u4e0d\u7b49\u5f0f\u306e\u53f3\u8fba\u306e\u5024\u3068\u3057\u3066\u8a08\u7b97\u7d50\u679c\u306b\u52a0\u7b97\u3057\u3066\uff0c\u6b21\u306b\u4eca\u5f8c\u305d\u306e\u5024\u304c\u4e0d\u7b49\u5f0f\u306e\u5de6\u8fba\u3068\u3057\u3066\u3069\u308c\u304f\u3089\u3044\u7d50\u679c\u306b\u5bc4\u4e0e\u3059\u308b\u304b\u3068\u3044\u3046\u306e\u3092\u8003\u3048\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3068\u3053\u308d\u3067\u4e0a\u8a18\u3092\u8e0f\u307e\u3048\u308b\u3068\uff0c\u4e00\u822c\u306b\u2026","provider_url":"https://hatena.blog","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkokiymgch.hatenablog.com%2Fentry%2F2020%2F11%2F03%2F143606\" title=\"\u6570\u5217\u4e0a\u306e\u6570\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u3042\u3063\u3066\u4e0d\u7b49\u5f0f\u3092\u6e80\u305f\u3059\u3082\u306e\u306e\u6570\u3092\u6570\u3048\u308b - Learning Algorithms\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>"}