![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
moyangxian
总会过去的
展开
-
HDU - 1166 敌兵布阵(树状数组)
题目链接解法一:树状数组#include<bits/stdc++.h>using namespace std;#define lowbit(x) ((x)&-(x))const int N=5e4+10;int sum[N];int n;void update(int x,int v){ while(x<=n){ sum[x]+...原创 2020-05-07 12:10:17 · 184 阅读 · 0 评论 -
POJ - 2182 Lost Cows(线段树,树状数组)
题目链接题记:做法一:暴力做法,时间复杂度O(n2)。#include<iostream>using namespace std;const int N=8010;int a[N],num[N],ans[N];int main(){ int n; cin>>n; for(int i=2;i<=n;i++) cin>>...原创 2020-05-06 14:45:21 · 140 阅读 · 0 评论