树状数组
TommyTT
我擦,要挂科了。
展开
-
hdu 1394 Minimum Inversion Number 树状数组+递推
hdu 1394 Minimum Inversion Number 树状数组+递推原创 2013-07-16 11:31:51 · 879 阅读 · 0 评论 -
POJ 2299 树状数组求逆序数+离散化
400ms+,速度很快啊……#include#include#includeusing namespace std;struct node{ int value; int pos;}a[500005];int c[500005];int b[500005];int n;bool cmp(const node &a,const node &b){原创 2013-07-16 11:01:54 · 720 阅读 · 0 评论 -
cf 61E. Enemy is weak 树状数组求逆序数
求出每个位置左边有几个比它大,右边有几个比它小,然后乘法原理加起来就够了。大于小于什么的用树状数组YY一下就出来了。#include#include#include#include#include#includeusing namespace std;int n;int c[2000000];struct node{ int x; int id;}a[原创 2014-01-20 17:05:28 · 870 阅读 · 0 评论