好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CF#261div2D.PashmakandParmida&#39;sproblem(树状数

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 a 1 ,? a 2 ,?...,? a n . Let's denote f ( l ,? r ,? x ) the number of indices k such that: l ?≤? k ?≤? r and a k ?=? x . His task is to calculate the number of pairs of indicies i ,? j (1?≤? i ? j ?≤? n ) such that f (1,? i ,? a i )?>? f ( j ,? n ,? a j ) .

Help Pashmak with the test.

查看更多关于CF#261div2D.PashmakandParmida&#39;sproblem(树状数的详细内容...

  阅读:30次