首页  >  文章  >  数据库  >  CF #261 div2 D. Pashmak and Parmida's problem (树状数组

CF #261 div2 D. Pashmak and Parmida's problem (树状数组

WBOY
WBOY原创
2016-06-07 15:13:551684浏览

Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak. There is a sequence a that con

Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.

There is a sequence a that consists of n integers a1,?a2,?...,?an. Let's denote f(l,?r,?x) the number of indices k such that: l?≤?k?≤?r and ak?=?x. His task is to calculate the number of pairs of indicies i,?j (1?≤?i?j?≤?n) such that f(1,?i,?ai)?>?f(j,?n,?aj).

Help Pashmak with the test.

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn