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 fo本文来源gaodaimacom搞#^代%!码网@llowing 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 indicesk such that: l?≤?k?≤?r andak?=?x. His task is to calculate the number of pairs of indiciesi,?j (1?≤?i?<?j?≤?n) such thatf(1,?i,?ai)?>?f(j,?n,?aj).
Help Pashmak with the test.