比赛 20151028a 评测结果 AAAAAAAAEEEEEEEEEETEEEEEEE
题目名称 复制&粘贴 最终得分 30
用户昵称 Fisher. 运行时间 5.957 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2017-09-19 20:03:00
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring> 
#include <cmath>
using namespace std;
/*
	暴力,甚至是我不知道复杂度的暴力?
	因为用了string的函数... 
*/
inline int read(){
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar();}
	return x*f;
}
const int maxl=1e9+10;
const int maxn=2e5+10;
int k,m,n;
string c;
int suml;
int main(){
	freopen("copypaste.in","r",stdin);
	freopen("copypaste.out","w",stdout);
	k=read();m=read();
	cin>>c;
	n=read();
	k--;
	for(int i=1;i<=n;i++){
		int l=read(),r=read(),p=read();
		r--;
		int len=r-l+1;
		string cao=c.substr(l,len);
		c.insert(p,cao);
		if(c.size()>m){
			int duo=c.size()-m;
			c.erase(m+1,duo); 
		}
	}
	for(int i=0;i<=k;i++)cout<<c[i];
	puts("");
	return 0;
}