[NOI 2003] Editor
来源:互联网 发布:hadoop python接口 编辑:程序博客网 时间:2024/05/22 16:33
rope大法好
//By Richard#include <cstdio>#include <algorithm>#include <iostream>#include <cstring>#include <cstdlib>#include <cmath>#include <ext/rope>#include <ctime>#define rep(x,y,z) for (int x=(y);(x)<=(z);(x)++)#define per(x,y,z) for (int x=(y);(x)>=(z);(x)--)#define log2(x) (31-__builtin_clz(x))#define mod (int)(1e9+7)#define inf 0x3f3f3f3f#define cls(x) memset(x,0,sizeof(x))#ifdef DEBUG#define debugdo(X) X#define debugndo(X)#define debugout(X) cout<<(#X)<<"="<<(X)<<endl#else#define debugdo(X)#define debugndo(X) X#define debugout(X)#endif // debug#ifdef ONLINE_JUDGE#define debugdo(X)#define debugndo(X)#define debugout(X)#endif#define putarray(x,n) rep(iiii,1,n) printf("%d ",x[iiii])#define mp make_pairusing namespace std;typedef pair<int,int> pairs;typedef long long LL;/////////////////////read4.0////////////////////////////////////template <typename T>inline void read(T &x){char ch;x=0;bool flag=false;ch=getchar();while (ch>'9'||ch<'0') {if (ch=='-') flag=true;ch=getchar();}while ((ch<='9'&&ch>='0')){x=x*10+ch-'0';ch=getchar();}if (flag) x*=-1;}template <typename T>inline void read(T &x,T &y){read(x);read(y);}template <typename T>inline void read(T &x,T &y,T &z){read(x);read(y);read(z);}/////////////////////graph///////////////////////////////#ifdef graphvconst int maxn=,maxm=;struct GRAPH{int next[maxm],first[maxn],to[maxm],value[maxm],cnt;void addedge(int x,int y,int z){next[++cnt]=first[x];first[x]=cnt;to[cnt]=y;value[cnt]=z;}void addedge2(int x,int y,int z){addedge(x,y,z);addedge(y,x,z);}void addedge2(int x,int y,int z,int xx){addedge(x,y,z);addedge(y,x,xx);}};#endif#ifdef graphnvconst int maxn=,maxm=;struct GRAPH{int next[maxm],first[maxn],to[maxm],cnt;void addedge(int x,int y){next[++cnt]=first[x];first[x]=cnt;to[cnt]=y;}void addedge2(int x,int y){addedge(x,y);addedge(y,x);}};#endif/////////////////variables&functions////////////////////using namespace __gnu_cxx;crope cr;int t,now,x;char s[3333333],ch;int main(){read(t);while (t--){ch=getchar();while (ch=='\n') ch=getchar();switch (ch){case 'M':read(now);break;case 'P':now--;while(ch!='\n')ch=getchar();break;case 'N':now++;while(ch!='\n')ch=getchar();break;case 'I':read(x);rep(i,0,x-1) {s[i]=getchar();if (s[i]=='\n') i--;}s[x]=0;cr.insert(now,s);getchar();break;case 'D':read(x);cr.erase(now,x);break;case 'G':read(x);cr.copy(now,x,s);s[x]=0;puts(s);break;puts("-1");}}return 0;}
阅读全文
0 0
- [NOI 2003] Editor
- [NOI 2003] 文本编辑器 editor
- BZOJ 1507 NOI 2003 Editor Splay
- Noi-03-editor
- 块状链表(附NOI 2003 Editor,POJ 2131 Key Insertion)
- Noi-2003-木棒游戏
- NOI 2003 题解
- NOI
- 【BZOJ1269】文本编辑器editor(AHOI2006)-NOI原题升级版
- NOI 2003 逃学的小孩
- Editor
- editor
- Editor
- NOI 2003 逃学的小孩【树形DP】
- Editor------------------Editor
- [NOI 2015复习][BZOJ 1509][NOI 2003]逃学的小孩(树的直径)
- [BZOJ 1509][NOI 2003]逃学的小孩(树的直径)
- bzoj 4622: [NOI 2003] 智破连环阵
- 突发事件属性库构建
- J2EE进阶之ajax和JSon使用 二十三
- BFS:UVa220 ACM/ICPC 1992-Othello(黑白棋)
- D
- Android Studio Set of source 代码源集
- [NOI 2003] Editor
- mybatis绑定错误
- [SDUT](3324)顺序表应用1:多余元素删除之移位算法 ---顺序存储(线性表)
- HDU5861-Road
- Java IO相关
- Spark四种运行模式
- C语言运算符优先级问题
- 将两个各自有序的链表,合成一个有序的链表
- 面试常见基本题目总结及php实现(第一部分:排序算法)