比赛 名字我取了 评测结果 AAAAAAAAAAAAAAA
题目名称 字串重组 最终得分 100
用户昵称 WHZ0325 运行时间 1.017 s
代码语言 C++ 内存使用 3.34 MiB
提交时间 2017-09-15 21:48:06
显示代码纯文本
#include <cstdio>
#include <cstring>
char s[1000005];
char t[1000005];
inline int _max(int a,int b) {
	return a>b?a:b;
}
int main() {
	freopen("R.in","r",stdin);
	freopen("R.out","w",stdout);
	int n;
	scanf("%d",&n);
	int len;
	int sum=0;
	int k;
	int loc;
	int fast;
	for(int i=0;i<n;i++) {
		scanf("%s",t);
		len=strlen(t);
		scanf("%d",&k);
		fast=-1;
		while(k--) {
			scanf("%d",&loc);
			loc--;
			sum=_max(sum,len+loc);
			for(int j=_max(fast,loc);j<loc+len;j++) {
				s[j]=t[j-loc];
			}
			fast=loc+len;
		}
	}
	for(int i=0;i<sum;i++) {
		if(s[i]==0) {
			putchar('a');
		}
		else {
			putchar(s[i]);
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}