CodeForces 828C String Reconstruction
来源:互联网 发布:瘦脸针副作用知乎 编辑:程序博客网 时间:2024/05/16 08:01
题目链接:http://codeforces.com/contest/828/problem/C
题意:告诉你一些字符串的信息,要求你重组并输出字典序最小的这个字符串,告诉你的信息是,某个子串在某几个位置出现,保证给的信息不冲突
解析:直接模拟做,但是要避免掉一些重复的情况
#include <bits/stdc++.h>using namespace std;const int maxn = 1e6+100;string s[maxn];vector<pair<int,int> >tmp;int main(void){ int n,k,x; scanf("%d",&n); for(int i=0;i<n;i++) { cin>>s[i]>>k; for(int j=0;j<k;j++) { scanf("%d",&x); tmp.push_back(make_pair(x,i)); } } sort(tmp.begin(),tmp.end()); string ans; int len = 1; for(unsigned i = 0;i<tmp.size();i++) { int t1 = tmp[i].first,t2 = tmp[i].second; while(t1>len) { ans += 'a'; len++; } //len-t1可以避免重复添加 for(unsigned j = len-t1;j<s[t2].length();j++) { ans += s[t2][j]; len++; } } cout<<ans<<endl; return 0;}
阅读全文
1 0
- CodeForces 828C String Reconstruction
- Codeforces 828 C String Reconstruction
- codeforces 828C. String Reconstruction
- Codeforces 828 C. String Reconstruction 思维
- CodeForces 828C String Reconstruction(思维)
- codeforces 828 c String Reconstruction(扫描线+string)
- Codeforces 828C String Reconstruction【思维+并查集】
- Codeforces #423-Div. 2-C. String Reconstruction
- Codeforces Round #423 C. String Reconstruction
- Codeforces Round #423 C. String Reconstruction
- String Reconstruction CodeForces
- Codeforces 827A/828C String Reconstruction[线段树单点更新]
- Codeforces Round #423 (Div. 2) C. String Reconstruction(字符串)
- Codeforces Round #423 (Div. 2) C. String Reconstruction
- Codeforces #848C: String Reconstruction 题解之花样虐题
- CF 828C String Reconstruction(暴力)
- Codeforces828 C. String Reconstruction
- Codeforces828 C. String Reconstruction
- Echarts2.0和Echarts3.0添加柱状图标签值
- Spark Streaming 将数据保存在msyql中
- 【笔记】linux tar命令简介
- SVN同步,更新,解决冲突的方法
- 实习点滴(2)--python统计ip地址出现的个数
- CodeForces 828C String Reconstruction
- Java八大基本类型支持的运算符
- Matlab 图像处理基本操作
- MySQL之——MySQL远程连接丢失问题解决方法(Lost connection to MySQL server)
- HDU2546~饭卡(01背包)
- Java学习笔记-002(环境的搭建及开发工具安装)
- ubuntu-视频格式转换
- 垃圾收集算法
- 微软企业库的使用