String Reconstruction
题意翻译
## 题目描述
Ivan有一个只包含小写英文字母的字符串s。然而他的朋友Julia为了捉弄他藏起了字符串s。
相比起找回原来的字符串,Ivan更倾向于造一个新的。
Ivan知道一些有关于字符串s的信息。这意味着他记得字符串$t_{i}$在字符串s中至少出现了$k_{i}$次,以及$k_{i}$个$t_{i}$在s中出现的位置--$x_{i,1}$,$x_{i,2}$,$x_{i,3}$,$x_{i,4}$,…,$x_{i,k_{i}}$。他记得n个这样的字符串$t_{i}$。
你要重建出一个符合Ivan记得的所有信息的字符串,如果有多个答案符合要求,取字典序最小的一个。字符串$t_{i}$只包含小写字母。
## 输入输出格式
### 输入格式:
第一行包括一个整数n(1<=n<=$10^{5}$),代表了Ivan所记得的字符串数量。
下面的n行包括有关于这些字符串的信息。第i+1包括一个非空字符串$t_{i}$,一个正整数$k_{i}$(代表了$t_{i}$在字符串s中出现的次数),然后是$k_{i}$个正整数$x_{i,1}$,$x_{i,2}$,$x_{i,3}$,$x_{i,4}$,…,$x_{i,k_{i}}$(升序输入),代表了$t_{i}$在字符串s中出现的起始位置。
保证字符串$t_{i}$的长度之和不超过$10^{6}$,1<=$x_{i,j}$<=$10^{6}$,1<=$k_{i}$<=$10^{6}$,且$k_{i}$的和不超过$10^{6}$。可能存在相同的$t_{i}$。
数据保证一定有解。
### 输出格式:
输出满足条件的字典序最小的字符串。
题目描述
Ivan had string $ s $ consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string $ s $ . Ivan preferred making a new string to finding the old one.
Ivan knows some information about the string $ s $ . Namely, he remembers, that string $ t_{i} $ occurs in string $ s $ at least $ k_{i} $ times or more, he also remembers exactly $ k_{i} $ positions where the string $ t_{i} $ occurs in string $ s $ : these positions are $ x_{i,1},x_{i,2},...,x_{i,ki} $ . He remembers $ n $ such strings $ t_{i} $ .
You are to reconstruct lexicographically minimal string $ s $ such that it fits all the information Ivan remembers. Strings $ t_{i} $ and string $ s $ consist of small English letters only.
输入输出格式
输入格式
The first line contains single integer $ n $ ( $ 1<=n<=10^{5} $ ) — the number of strings Ivan remembers.
The next $ n $ lines contain information about the strings. The $ i $ -th of these lines contains non-empty string $ t_{i} $ , then positive integer $ k_{i} $ , which equal to the number of times the string $ t_{i} $ occurs in string $ s $ , and then $ k_{i} $ distinct positive integers $ x_{i,1},x_{i,2},...,x_{i,ki} $ in increasing order — positions, in which occurrences of the string $ t_{i} $ in the string $ s $ start. It is guaranteed that the sum of lengths of strings $ t_{i} $ doesn't exceed $ 10^{6} $ , $ 1<=x_{i,j}<=10^{6} $ , $ 1<=k_{i}<=10^{6} $ , and the sum of all $ k_{i} $ doesn't exceed $ 10^{6} $ . The strings $ t_{i} $ can coincide.
It is guaranteed that the input data is not self-contradictory, and thus at least one answer always exists.
输出格式
Print lexicographically minimal string that fits all the information Ivan remembers.
输入输出样例
输入样例 #1
3
a 4 1 3 5 7
ab 2 1 5
ca 1 4
输出样例 #1
abacaba
输入样例 #2
1
a 1 3
输出样例 #2
aaa
输入样例 #3
3
ab 1 1
aba 1 3
ab 2 3 5
输出样例 #3
ababab