CF543C Remembering Strings 状压dp】的更多相关文章

Code: #include <cstdio> #include <algorithm> #include <cstring> #define setIO(s) freopen(s".in","r",stdin) #define inf (1<<22) #define maxn 30 using namespace std; char s[maxn][maxn]; int data[maxn][maxn],common…
题目链接 题意: 给定n个长度均为m的字符串 以下n行给出字符串 以下n*m的矩阵表示把相应的字母改动成其它字母的花费. 问: 对于一个字符串,若它是easy to remembering 当 它存在一个字母.使得这个字母在这一列是独一无二的. 要使得n个字符串都是easy to remembering 的最小花费. 第一个例子是把第一列的4个a中3个a改动成别的字母.所以花费为3. 思路: 显然是个状压dp,但须要一点转化. 首先得到一个结论: 对于某一列,设这一列的字母是 a,a,b,b,a…
C - Remembering Strings 思路:最关键的一点是字符的个数比串的个数多. 然后就能状压啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int, int> #define y1 skldjfskldjg #define y2 skldfjsklejg using names…
题目大意:甲和乙玩游戏,甲给出n(n<=50)个等长的字符串(len<=20),然后甲选出其中一个字符串,乙随机询问该字符串某一位的字符(不会重复询问一个位置),求乙能确定该串是哪个字符串的询问次数的期望值 这题不看题解好难想......(感谢zhx和zhx两位大佬的题解) len很小,考虑状压DP,显然我们要状压询问,要定义两个状态,f[]和num[] 1表示询问,0表示未询问 那么,我们定义f[s]表示询问状态s距离确定一个字符串所需要的期望值. 定义tot是s状态剩余的询问的次数,那么显…
E. Remembering Strings 题目大意: You have multiset of n strings of the same length, consisting of lowercase English letters. We will say that those strings are easy to remember if for each string there is some position i and some letter c of the English…
G - Simple String Problem Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2218 Description Recently, you have found your interest in string theory. Here is an interesting question about strings.…
Resource Archiver Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 100000/100000 K (Java/Others)Total Submission(s): 2382    Accepted Submission(s): 750 Problem Description Great! Your new software is almost finished! The only thing left to…
题目链接:https://vjudge.net/problem/HDU-3247 Resource Archiver Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 100000/100000 K (Java/Others)Total Submission(s): 3228    Accepted Submission(s): 1052 Problem Description Great! Your new software i…
Simple String Problem Recently, you have found your interest in string theory. Here is an interesting question about strings. You are given a string S of length n consisting of the first k lowercase letters. You are required to find two non-empty sub…
Great! Your new software is almost finished! The only thing left to do is archiving all your n resource files into a big one. Wait a minute… you realized that it isn’t as easy as you thought. Think about the virus killers. They’ll find your software…