代码:
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int tree[1001000],b[1001000],n;
struct node
{
int value,no;
}arr[1001000];
int cmp(node x,node y)
{
return x.value<y.value;
}
int LowBit(int x)
{
return x&(-x);
}
__int64 GetSum(int x)
{
__int64 temp=0;
for(int i=x;i<=n;i+=LowBit(i))
temp+=tree[i];
return temp;
}
void UpDate(int x,int c)
{
for(int i=x;i>=1;i-=LowBit(i))
tree[i]+=c;
}
int main()
{
while(scanf("%d"......
阅读全文