比赛 名字我取了 评测结果 AAAAAAAAAAAAAAA
题目名称 字串重组 最终得分 100
用户昵称 Shirry 运行时间 0.943 s
代码语言 C++ 内存使用 38.46 MiB
提交时间 2017-09-15 20:43:46
显示代码纯文本
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,t,p,h,maxx;
const int maxn=20000010;
char b[maxn],s[maxn];
int main(){
	freopen("R.in","r",stdin);
	freopen("R.out","w",stdout);
	for(int i=0;i<=1000000;i++)b[i]='a';
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%s%d",&s,&t);
		int tmp=-maxn;h=strlen(s);
		for(int j=1;j<=t;j++){
			scanf("%d",&p),p--;
			maxx=max(p+h,maxx);
			for(int k=max(tmp,p);k<p+h;k++)b[k]=s[k-p];
			tmp=p+h;
		}
	}
	for(int i=0;i<maxx;i++)printf("%c",b[i]);
	return 0;
}