```cpp
#include<iostream>
#include<cstdio>
using namespace std;
int n,top;
char a[100005];
int main()
{
scanf("%d",&n);
while(n--)
{
char ch;
cin>>ch;
if(ch=='T')cin>>a[++top];
else if(ch=='U')
{
int x;
scanf("%d",&x);
top-=x;
}
else
{
int x;
scanf("%d",&x);
cout<<a[x]<<endl;
}
}
return 0;
}
```
by insprition @ 2017-09-12 11:08:32
@[insprition](/space/show?uid=18146) 你的top可以是负的
所以可以负界访问
出题人大概没刹住车 出了一些不对的数据
by 封癫 @ 2017-09-12 12:16:06
而且好像有撤销“撤销”的操作
by 封癫 @ 2017-09-12 12:16:40
WTF??
这题不是可持久化线段树 喵喵喵??
by Satori @ 2017-10-16 21:34:53
那些说主席树的是什么心态啊??喵喵喵???
by Satori @ 2017-10-16 21:37:12
额。。。那就写主席树不就好了??
by 青衫白叙 @ 2017-10-16 21:38:22
可持久化线段树和主席树有什么区别么。。@[ZlyingL](/space/show?uid=57743)
by 青衫白叙 @ 2017-10-16 21:39:23
一个难写,一个不仅难写说出来还会被lxl打
@[青衫白叙](/space/show?uid=48991)
by Night_Aurora @ 2017-10-16 21:42:40
@[Night\_Aurora](/space/show?uid=25508) 额,然后dalao我能说我没听懂吗??
by 青衫白叙 @ 2017-10-16 21:43:22
~~其实这题可以用rope随便水。。。~~
by 青衫白叙 @ 2017-10-16 21:44:06