并查集维护和我这个位置的字母连续的已经被填充的字母能到达的最右边的第一个还没有填充的位置,然后把这个位置填上应该填的东西,然后把这个位置和下一个位置连接起来,如果下一个位置还没有填,我就会把下一个位置填上,如果填过了,就会跳到后面的还没有填的地方

#include<map>
#include<set>
#include<ctime>
#include<cmath>
#include<stack>
#include<queue>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define lowbit(x) (x & (-x))
#define INOPEM freopen("in.txt", "r", stdin)
#define OUTOPEN freopen("out.txt", "w", stdout) typedef unsigned long long int ull;
typedef long long int ll;
const double pi = 4.0*atan(1.0);
const int inf = 0x3f3f3f3f;
const int maxn = 2e6+;
const int maxm = ;
const int mod = 1e9+;
using namespace std; int n, m;
int T, tol;
char tmp[maxn];
char s[maxn];
int fa[maxn]; int find(int x) {
return fa[x] == x ? x : fa[x] = find(fa[x]);
} void bind(int u, int v) {
int x = find(u);
int y = find(v);
if(x == y) return ;
if(x < y) fa[x] = y;
else fa[y] = x;
return ;
} int main() {
memset(s, , sizeof s);
for(int i=; i<maxn; i++) fa[i] = i;
scanf("%d", &m);
n = ;
int q;
while(m--) {
scanf("%s", tmp);
int len = strlen(tmp);
scanf("%d", &q);
while(q--) {
int pos;
scanf("%d", &pos);
n = max(n, pos+len-);
for(int i=find(pos); i<pos+len; i=find(i+)) {
s[i] = tmp[i-pos];
bind(i, i+);
}
}
}
for(int i=; i<=n; i++) printf("%c", s[i] ? s[i] : 'a');
printf("\n");
return ;
}

最新文章

  1. 在centos7中安装Robot Framework
  2. C# 字符编码解码 Encoder 和Decoder
  3. App 即时通讯 SDK
  4. J2EE中关于tomcat的maxIdle、maxActive、maxActive相关配置
  5. cf.301.D. Bad Luck Island(dp + probabilities)
  6. [http session]
  7. Android显示基础--单位与尺寸
  8. 1、JavaScript入门篇
  9. $geoNear
  10. git推送本地分支到远端 以及删除远端分支的 命令
  11. Git分支学习总结
  12. UIAlertController(警告栏) 自学之初体验
  13. Eclipse用法和技巧二十:一个快速打印技巧
  14. 【算法】赫夫曼树(Huffman)的构建和应用(编码、译码)
  15. 天梯赛-L1-018. 大笨钟
  16. 【Linux】配置SSH Key到GitHub/GitLab
  17. 转:Flutter动画二
  18. SpringBoot笔记十五:任务
  19. 通过adb启动app应用
  20. Maths | Metropolis-Hastings algorithm

热门文章

  1. toTree
  2. WPF中定时器Timer与DispatcherTimer的用法
  3. 2 JAVA 项目名称前红色叹号如何解决
  4. [转帖]SSH 的 三种代理功能.
  5. 二进制安装MongoDB
  6. 关于SQL查询语句中的LIKE模糊查询的解释
  7. HTTP协议 - 使用php模拟get/post请求
  8. bmi
  9. 10.Service资源发现
  10. codeforces570C