[CodeForces]String Reconstruction】的更多相关文章

http://codeforces.com/contest/828/problem/C 并查集的神奇应用. #include<bits/stdc++.h> using namespace std; const int maxn=10000005; char s[maxn]; string ss[100000]; vector<int> g[100000]; int fa[maxn]; int findfa(int x) { if (fa[x]==x) return x; else…
C. String Reconstruction 题目连接: http://codeforces.com/contest/828/problem/C Description 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 strin…
题目链接:http://codeforces.com/contest/828/problem/C C. String Reconstruction time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ivan had string s consisting of small English letters. However, hi…
C - String Reconstruction 方法一:把确定的点的父亲节点设为下一个点,这样访问过的点的根节点都是没访问过的点. 代码: #include<bits/stdc++.h> using namespace std; ; ]; ]; int Find(int x) { return x==fa[x]?x:fa[x]=Find(fa[x]); } int main() { ;i<N*;i++)fa[i]=i; int n,t,x; scanf("%d",…
String Reconstruction 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 s…
题目链接:String Similarity 题意: 首先题目定义了两个串的相似(串的构成是0.1),如果两个串存在对于一个下标k,它们的值一样,那么这两个串就相似 然后题目给你一个长度为2n-1的串,我们设下标从1开始,那么[1,n],[2,n+1],[3,n+2]...[n,2n-1]每一个都是一个长度为n的串,你需要找出来长度为n的串,使得这个串和[1,n],[2,n+1],[3,n+2]...[n,2n-1]这些串都相似 题解: 你会发现,只需要输出原长度为2n-1串的下标1,3,5,7…
C. String Reconstruction time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid…
CF1400-C. Binary String Reconstruction 题意: 对于一个二进制字符串\(s\),以及一个给定的\(x\),你可以通过一下操作来得到字符串\(w\): 对于字符串\(s\)的第\(i\)位, 1. 如果\(i-x\)有意义并且\(s[i-x]==1\)那么\(w[i]=1\) ; 2.如果\(i+x\)有意义并且\(s[i+x]==1\),那么\(w[i]=1\); 如果上面两条都不符合,那么\(w[i]=0\). 现在题目给出你字符串\(w\)和\(x\),…
[Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i个字符t[i],在k[i]个位置出现过; 且告诉你这k[i]个位置在哪里; 数据不会产生矛盾; 让你输出最终的字符串,输出字典序最小的那个; [Solution] 对于输入的n个子串; 对于每个位置; 看看那个位置有没有子串之前出现过,没有的话,就放在那个位置; 否则,如果当前这个子串ti的长度比原…
题目链接:http://codeforces.com/contest/828/problem/C 题解:有点意思的题目,可用优先队列解决一下具体看代码理解.或者用并查集或者用线段树都行. #include <iostream> #include <cstring> #include <queue> #include <vector> #include <cstdio> #include <map> #include <strin…