Codeforces Round #438 D. Huge Strings】的更多相关文章

Description You are given n strings s1, s2, ..., sn consisting of characters 0 and 1. m operations are performed, on each of them you concatenate two existing strings into a new one. On the i-th operation the concatenation saisbi is saved into a new…
本来兴致勃勃的想乘着这一次上紫,于是很早很早的到了机房 但是好像并没有什么用,反而rating-=47 Codeforces Round #438(Div.1+Div.2) 今天就这样匆匆的总结一下,心情不好qaq 首先是 A.Bark to Unlock 启示:(1)不能直接把char数组进行比较!!! (2)读题要读清,不能漏读条件!!! #include<bits/stdc++.h> using namespace std; ][],n; string s,t; int main(){…
题目链接:868D - Huge Strings 题目大意:有\(n\)个字符串,\(m\)次操作,每次操作把两个字符串拼在一起,并询问这个新串的价值.定义一个新串的价值\(k\)为:最大的\(k\),使得这个新串包含所有长度为\(k\)的01串(这样的字符串有\(2^k\)个) 题解:首先来证明对于任何的串,这个\(k\)的值不会超过9 若\(k=10\),由所有字符串的长度总和不超过100,因此在初始的\(n\)个串里,互不相同的长度为\(k\)的子串不超过100个.又由于每次连接最多能产生…
题目所在比赛的地址在这里呀 A. Bark to Unlock ·述大意:       输入一个目标串.然后输入n(1<=n<=100)个串,询问是否可以通过这些串收尾相接或者它本身拼出目标串(比如ab rt 可拼出ab rt br ta),输出就是 Yes或者No.提到的串长度都为2. ·分析:       直接按照题目说的,一种是自己本身等于目标串,一种是两个串拼出了目标串所以前者O(n)后者O(n2),就没啦. #include<stdio.h> #define go(i,a…
http://codeforces.com/contest/868/problem/D 优化:两个串合并 原有状态+ 第一个串的尾部&第二个串的头部的状态 串变为第一个串的头部&第二个串的尾部 注意: 头尾不能重复 如串A合并串A 这就意味着串的头尾不能有重合, 详见代码 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <…
C. Simple Strings 题目连接: http://www.codeforces.com/contest/665/problem/C Description zscoder loves simple strings! A string t is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add a…
Description Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox! Space and time…
Description Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset. k experienced teams are pa…
D. Equivalent Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal l…
A. Bark to Unlock 题目链接:http://codeforces.com/contest/868/problem/A 题目意思:密码是两个字符组成的,现在你有n个由两个字符组成的字符串,现在问是否可以用你手上的这些字符串通过拼接其中两个的基础上使得密码是这个拼接而成的字符串的子串,一个字符串可以使用多次,这意味这自己拼接自己也是可以的. 题目思路:暴力枚举这个过程,因为总共就n最大也就100 代码: /* *************************************…
C. Two strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given two strings a and b. You have to remove the minimum possible number of consecutive (standing one after another)…
C. Qualification Rounds time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They…
最近只想喊666,因为我是真得菜,大晚上到网吧打代码还是很不错的嘛 A. Bark to Unlock time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As technologies develop, manufacturers are making the process of unlocking a phone as us…
题目链接:868C - Qualification Rounds 题目大意:有\(n\)个题目,\(k\)个人,每个人可能做过这\(n\)个题里的若干道,出题方要在这\(n\)个题目里选若干个出来作为一套题.称一套题有趣的当且仅当对于任意一个人,他在这套题里做过的题目数不超过总题数的一半,问是否存在这样的一套题. 题解:设第\(i\)道题有\(p_i\)个人做过,显然当存在有\(p_i =0\)时单独把这道题放入套题里即可. 若存在\(p_i =1\),设做过这道题的人为\(X\),则只需要找到…
题意:给你一个原串和n个子串,问你这n个子串任意组合起来能不能使原串出现,串的长度为2. Examples Input ya4ahoytoha Output YES Input hp2http Output NO Input ah1ha Output YES 思路: 首先如果输入的就有原串那么肯定可以:若没有,那么就记录一下每个子串的第一个字母是否等于原串的第二个字母, 第二个字母是否等于原串的第一个字母,因为这样可以拼接起来构成原串,按照最后一个样例,好像每个子串可以用多次. 代码:#incl…
[链接]h在这里写链接 [题意] 给你n个问题,每个人都知道一些问题. 然后让你选择一些问题,使得每个人知道的问题的数量,不超过这些问题的数量的一半. [题解] 想法题. 只要有两个问题. 这两个问题,每个人最多只知道其中一个. 或是有一个问题,所有人都不知道就可以了. 那么就是YES. 否则NO. [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc++.h> using namespace std; int n,k; int bo[20000]; in…
[链接]h在这里写链接 [题意] 时针.分钟.秒针走不过去. 问你从t1时刻能不能走到t2时刻 [题解] 看看时针.分钟.秒针的影响就好. 看看是不是在整时的位置就好. 然后看看影响到x不能到y; 然后从t1开始逆时针或顺时针一直走 [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc++.h> using namespace std; bool bo[20][20]; int h,m,s,t1,t2; int nex(int x) { if (x+1&g…
[链接]h在这里写链接 [题意] 在这里写题意 [题解] 枚举它是在连接处,还是就是整个字符串就好. [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc++.h> using namespace std; const int N = 100; string s; string ts[N+10]; int main() { //freopen("F:\\rush.txt","r",stdin); ios::sync_…
题目链接 传送门 题意 现总共有\(n\)个题目\(k\)支参赛队伍,已知每个题目各队伍是否会写,现问你能否从题目中选出一个子序列使得每支队伍最多只会写一半的题目. 思路 对于每个题目我们用二进制压缩所有队伍的情况,然后通过枚举状态看是否存在两种完全不同的状态是否同时出现过. 代码实现如下 #include <set> #include <map> #include <deque> #include <queue> #include <stack>…
8说了 #include<bits/stdc++.h> using namespace std; #define int long long signed main(){ string str; cin>>str; int _; cin>>_; ; ; ; ; while(_--){ string s; cin>>s; if(s==str){ flag4=; continue; } ]==str[]&&s[]==str[]){ flag3=;…
题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> #include <iostream> #include <cstring> #include <string> #include <algorithm> using namespace std; ; const int INF = 0x3f3f3f3f;…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://codeforces.com/contest/985/problem/F Description You are given a string s of length n consisting of lowercase English letters. For two given strings s an…
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute…
Codeforces Round #270 1003 C. Design Tutorial: Make It Nondeterministic time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A way to make a new task is to make it nondeterministic or probabili…
Codeforces Round #177 (Div. 1) A. Polo the Penguin and Strings 题意 让你构造一个长度为n的串,且里面恰好包含k个不同字符,让你构造的字符串字典序最小. 题解 先abababab,然后再把k个不同字符输出,那么这样就是最少 代码 #include<bits/stdc++.h> using namespace std; string s; int main() { int n,k; scanf("%d%d",&am…
A. Contest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Misha and Vasya participated in a Codeforces contest. Unfortunately, each of them solved only one problem, though successfully sub…
Codeforces Round #114 (Div. 2) 代码 Codeforces Round #114 (Div. 2) C. Wizards and Trolleybuses 思路 每条车的到达时间不会小于前一辆车,计算两者时间取最大值. D. Wizards and Huge Prize 思路 \(f(i, j, k)\)表示前\(i\)场比赛赢\(j\)场袋子与奖牌的差值为\(k\)的概率. E. Wizards and Numbers 假设\(a \le b\),那么最后会进入状…
Codeforces Round #112 (Div. 2) C. Another Problem on Strings 题意 给一个01字符串,求包含\(k\)个1的子串个数. 思路 统计字符1的位置,两端用0填充. \(k=0\)需要特判. 代码 C. Another Problem on Strings D. Beard Graph 题意 一棵\(N(N \le 10^5)\)个点的树,每条边被染成黑色或白色,初始都是黑色. \(M(M \le 3 \times 10^5)\)次操作,要么…
Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase Engl…
Codeforces Round #270 A. Design Tutorial: Learn from Math time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from math. You can generate some random math s…