I tried to solve this question but suddenly a question strike to my mind what if we have to find the value of ONLY F(L,R,X)↵
one solution which strike to me is like..just take map< long long,vector<int> >mp,and for each elementfoof the given array just insert its corresponding index at that location for example if arr[]=[2,3,4,5,2,2].So mp[2]={0,5,6},mp[3]={3},mp[4]={2} and so on...↵
and just take lower bound and upper bound of the value of L and R in mp[x]. So it will give us answer in ↵
NO of Query * O(log(abs(R-L)).↵
↵
But Can some one please suggest me **how can i can calculate ONLY F(L,R,X) by using SEGMENT TREE** ↵
[Proble Link](http://codeforces.com/problemset/problem/459/D).....↵
↵
Thanks In Advance..!!↵
one solution which strike to me is like..just take map< long long,vector<int> >mp,and for each element
and just take lower bound and upper bound of the value of L and R in mp[x]. So it will give us answer in ↵
NO of Query * O(log(abs(R-L)).↵
↵
But Can some one please suggest me **how can i can calculate ONLY F(L,R,X) by using SEGMENT TREE** ↵
[Proble Link](http://codeforces.com/problemset/problem/459/D).....↵
↵
Thanks In Advance..!!↵