本文整理汇总了C++中SegmentTree::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ SegmentTree::clear方法的具体用法?C++ SegmentTree::clear怎么用?C++ SegmentTree::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SegmentTree
的用法示例。
在下文中一共展示了SegmentTree::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void) {
T = in();
int kind;
SegmentTree tree;
for ( ; T--; ) {
N = in();
C = in();
tree.clear();
for ( ; C--; ) {
kind = in();
if (kind == 0) {
P = in();
Q = in();
V = in();
tree.update(1, 1, N, P, Q, V);
} else {
P = in();
Q = in();
printf("%lld\n", tree.query(1, 1, N, P, Q));
}
}
}
return 0;
}
示例2: main
int main(){
//Treap::Node* test = Treap::nil;
//Treap::insert(test, 1);
//cout << Treap::getRank(test, 2) << endl;
scanf("%d", &TestNum);
while (TestNum--){
scanf("%d", &n);
int m; scanf("%d", &m);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
SegmentTree::Node root(0, n - 1);
tree.init(root);
while (m--){
char buf[32]; scanf("%s", buf);
if (buf[0] == 'Q'){
int i, j, k; scanf("%d %d %d", &i, &j, &k);
printf("%d\n", getKth(i - 1, j - 1, k - 1));
}else{
int i, t; scanf("%d %d", &i, &t);
tree.gao(i -1 , i - 1).update(root, a[i - 1], t);
a[i - 1] = t;
}
//printf("new_cnt: %d\n", new_cnt);
}
tree.clear(root);
//printf("new_cnt: %d\n", new_cnt);
assert(new_cnt == 0);
//len = 1;
}
}
示例3: expend
void expend(int np)
{
if(str[np] != chr[3]) return;
int lm = startE(np);
if(!lm) return;
printf("ex-lm: %d %d\n", lm, np);
tree.clear(1,lm,np);
tree.update(1,np);
}