#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
using namespace std;
#define LL long long
const int INF = 0x3f3f3f3f;
#define MAXN 500
char s[2000006];
char ch[2000005];
int main()
{
int n,m,x;
int tot=0;
scanf("%d",&n);
for(int i=0; i<n; i++)
{
scanf("%s%d",&ch,&m);
int k=strlen(ch);
int t=-INF;
for(int j=0; j<m; j++)
{
scanf("%d",&x);
x--;
tot=max(x+k,tot);
for(int l=max(x,t); l<x+k; l++)
s[l]=ch[l-x];
t=x+k;
}
}
for(int i=0; i<tot; i++)
if(s[i]=='\0')
printf("a");
else
printf("%c",s[i]);
printf("\n");
return 0;
}
字符串重构算法

本文介绍了一个字符串重构问题,目标是根据给定的子串出现次数及其位置信息,构造出一个字典序最小的字符串。通过逐个处理每个字符信息并利用位置递增特性,避免重复覆盖,最终生成符合条件的字符串。
626

被折叠的 条评论
为什么被折叠?



