可持化永久树 的 STL ( rope )
rope 的基本操作
#include <ext/rope>
using namespace __gnu_cxx;
int a[];
rope<int> x;
rope<int> x(a,a + n);
rope<int> a(x); x->at();
x[];
x->push_back(x) // 在末尾添加x
x->insert(pos,x) // 在pos插入x
x->erase(pos,x) // 从pos开始删除x个
x->replace(pos,x) // 从pos开始换成x
x->substr(pos,x) // 提取pos开始x个
#include<iostream>
#include<ext/rope>
using namespace std;
using namespace __gnu_cxx;
rope<int>a;
int main(){
int n,m,x,y;
scanf("%d%d",&n,&m);
for(int i=;i<=n;i++) a.push_back(i);
for(int i=;i<m;i++){
scanf("%d%d",&x,&y);
a.insert(,a.substr(x-,y));
a.erase(x+y-,y);
}
printf("%d",a[]);
for(int i=;i<n;i++) printf(" %d",a[i]);
puts("");
}
可持化永久树 的 STL ( rope )的更多相关文章
- 【BZOJ2333】棘手的操作(左偏树,STL)
[BZOJ2333]棘手的操作(左偏树,STL) 题面 BZOJ上看把... 题解 正如这题的题号 我只能\(2333\) 神TM棘手的题目... 前面的单点/联通块操作 很显然是一个左偏树+标记 ( ...
- ACM: 强化训练-Inversion Sequence-线段树 or STL·vector
Inversion Sequence Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%lld & %llu D ...
- C++ STL rope介绍----可持久化平衡树
大致介绍: rope这个东西,我刚刚知道这玩意,用的不是很多,做个简单的介绍. 官方说明:我是刘邦(我估计你是看不懂的). rope就是一个用可持久化平衡树实现的“重型”string(然而它也可以保存 ...
- C++ STL rope 可持久化平衡树 (可持久化数组)
官方文档好像 GG 了. rope 不属于标准 STL,属于扩展 STL,来自 pb_ds 库 (Policy-Based Data Structures). 基本操作: #include <e ...
- SGI STL rope
rope实现的接口可以参考这里. rope是可伸缩的string实现: 它们被设计为用于把string看作一个整体的高效操作 . 比如赋值.串联和子串的操作所花的时间差不多不依赖字符串的长度.与C的字 ...
- STL rope
rope的部分简单操作 函数 功能 push_back(x) 在末尾添加x insert(pos,x) 在pos插入x erase(pos,x) 从pos开始删除x个 replace(pos,x) 从 ...
- Phone List 字典树 OR STL
Phone List Time Limit: 1 Sec Memory Limit: 128 Mb Submitted: 140 Solved: 35 Description ...
- STL - rope 【强大的字符串处理容器】
包含头文件: #include<ext/rope> using namespace __gnu_cxx; 申请: rope text; 基本操作: test.push_back(x); / ...
- HDU 1800 Flying to the Mars 字典树,STL中的map ,哈希树
http://acm.hdu.edu.cn/showproblem.php?pid=1800 字典树 #include<iostream> #include<string.h> ...
随机推荐
- java集合框架面试要点整理
- AngularJS之ng-class
https://www.cnblogs.com/CreateMyself/p/5566412.html
- Eureka 系列(06)消息广播(下):TaskDispacher 之 Acceptor - Worker 模式
Eureka 系列(06)消息广播(下):TaskDispacher 之 Acceptor - Worker 模式 [TOC] Spring Cloud 系列目录 - Eureka 篇 Eureka ...
- arcpy-栅格转其他格式
import arcpy in_format=arcpy.GetParameterAsText(0) out_format=arcpy.GetParameterAsText(1) out_folder ...
- 2018年分享的Spring Cloud 2.x系列文章
还有几个小时2018年就要过去了,盘点一下小编从做做公众号以来发送了273篇文章,其中包含原创文章90篇,虽然原创的有点少,但是2019年小编将一如既往给大家分享跟多的干货,分享工作中的经验,让大家在 ...
- 案例- CSS 三角加强
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- windows API 第22篇 WTSGetActiveConsoleSessionId
函数原型:DWORD WTSGetActiveConsoleSessionId (VOID)先看一下原文介绍: The WTSGetActiveConsoleSessionId function re ...
- 使用Gradle发布项目到JCenter仓库 (转载)
原文:使用Gradle发布项目到JCenter仓库 这篇文章介绍通过Gradle把开源项目发布到公共仓库JCenter中,方便你我他的事情,我们都是很懒的嘛.JCenter现在是Android Stu ...
- printf函数与缓冲区
printf函数与缓冲区 printf函数是一个行缓冲函数,先将内容写到缓冲区,满足一定条件后,才会将内容写入对应的文件或流中. 基本条件如下: .缓冲区填满 .写入的字符中有‘\n’ '\r' .调 ...
- git常用操作命令归纳
git开始 全局配置:配置用户名和e-mail地址 $ git config --global user.name"Your Name" $ git config --global ...