一般说的浅谈是永远不会短的 

然后$qwq$本宝宝并不想讲实现原理 会用就行了呗    

然后方便起见,本文规定数组$a$的第$1$位为$a[0]$

并且本文的所有$debug$为了方便看到我们$rope$长度之后的东西,会多输出若干位(看$debug$程序就懂了)

所以一些输出可能跟我的不一样(比较明显,显然数组越界)

进入正题

首先需要的头文件:

#include<ext/rope>

需要的命名空间

using namespace __gnu_cxx;

之后声明一个$rope$

rope</*这里面是填变量类型*/> ro;

如果命名空间是$std$的话可以这么写:

__gnu_cxx::rope</*变量类型*/> ro;

这里以变量类型为$int$的$rope$来举例

前置技能是知道怎么访问:

获取$ro$的第$i$位是$ro[i-1]$ 因为$rope$是从$0$开始的

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<ext/rope>
using namespace std;
__gnu_cxx::rope<int>ro;
int n,m,p;
void debug(int len)
{
    for(int i=0;i<=len;i++) printf("%d %d \n",i,ro[i]);//输出0~len这len+1位存的是啥 
    puts("");
    return ; 
}
前置头文件+函数+声明

相关文章:

  • 2021-08-12
  • 2021-08-13
  • 2021-11-27
  • 2022-12-23
  • 2021-11-19
  • 2021-11-29
  • 2022-01-07
  • 2021-06-26
猜你喜欢
  • 2021-12-11
  • 2021-11-15
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
相关资源
相似解决方案