树状数组
2021-03-12 09:29
阅读:701
标签:std ring max else using string 树状 数组 name
树状数组
lowbit : 求最低位的 \(1\) 以及后面的 \(0\) 所组成的十进制数
#include
#include
#include
#include
#include
#define ll long long
using namespace std;
const ll maxn=5e5+10;
ll n,m;
struct node
{
ll tree[maxn];
ll lowbit(const ll x)
{
return x & -x;
}
void upd(ll p,ll w)
{
do tree[p]+=w;
while((p+=lowbit(p))
求逆序对:
#include
#include
#include
#include
#include
#define ll long long
using namespace std;
const ll maxn=5e5+10;
ll n,m,sum;
ll a[maxn],b[maxn],c[maxn];
inline ll lowbit(ll x)
{
return x & (-x);
}
inline void upd(ll x,ll w)
{
for( ;x
树状数组
标签:std ring max else using string 树状 数组 name
原文地址:https://www.cnblogs.com/jd1412/p/14087315.html
上一篇:Java层反调试
下一篇:6 Java内存模型基础知识
评论
亲,登录后才可以留言!